Error: dynamodb query not returning the full item

Answered by Rafal Wilinski
Last updated: October 23rd, 2026
Solution
Query returns only the attributes allowed by its request projection and the selected index's projection. Removing ProjectionExpression cannot make a GSI return attributes that were never projected into that index.
- Check ProjectionExpression and legacy AttributesToGet settings in the outgoing request. Remove them when all available attributes are needed.
- If IndexName identifies a GSI, inspect its ProjectionType: KEYS_ONLY, INCLUDE or ALL. A GSI cannot fetch missing attributes from the base table.
- Use the base-table keys returned by the GSI to GetItem or BatchGetItem from the table. Handle UnprocessedKeys when batching.
- For a recurring access pattern, consider a replacement GSI with the needed projection. Existing GSI projections cannot be changed in place.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, QueryCommand } from "@aws-sdk/lib-dynamodb";
const db = DynamoDBDocumentClient.from(new DynamoDBClient({}));
const result = await db.send(new QueryCommand({
TableName: "Orders",
KeyConditionExpression: "pk = :pk",
ExpressionAttributeValues: { ":pk": "CUSTOMER#123" },
}));This example queries the base table without a projection. Index projection changes affect storage and write work, so ALL is a design choice, not a universal fix. Missing items across pages are a separate pagination issue; follow LastEvaluatedKey until absent.
See index projections and AWS documentation.
Other Common DynamoDB Errors (with Solutions)
- dynamodb the parameter cannot be converted to a numeric value NaN
- DynamoDB BatchWriteItem error
- DynamoDB Query Limit Not Working
- DynamoDB Mapper Could Not Instantiate Class
- dynamodb problem function call failed
- dynamodb could not load credentials from any providers
- dynamodb global secondary index does not project
- DynamoDB Is Unsupported It Cannot Be Instantiated
- DynamoDB Get not found
- DynamoDB - The Security Token Included In The Request Is Invalid
- dynamodb request is missing authentication token
- dynamodb property projection cannot be empty
- dynamodb streams missing events
- dynamodb query is null
- dynamodb cannot convert undefined to object
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
DynamoDB Tools
- SSH GUI Client
- Chat With Cloud
- MongoDB GUI Client
- AWS Cost Monitoring
- DynamoDB Query Builder
- DynamoDB Code Examples
- DynamoDB Node.js Queries
- DynamoDB JSON Converter
- DynamoDB UUID Generator
- DynamoDB Local Admin GUI
- DynamoDB Pricing Calculator
- DynamoDB Single-Table Design
- Best DynamoDB GUI Clients
- Dynobase vs DynoTable
DynamoDB Info
© 2026 Dynobase