dynobase-icon
Dynobase

Error: dynamodb query not returning the full item

Rafal Wilinski

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.

  1. Check ProjectionExpression and legacy AttributesToGet settings in the outgoing request. Remove them when all available attributes are needed.
  2. If IndexName identifies a GSI, inspect its ProjectionType: KEYS_ONLY, INCLUDE or ALL. A GSI cannot fetch missing attributes from the base table.
  3. Use the base-table keys returned by the GSI to GetItem or BatchGetItem from the table. Handle UnprocessedKeys when batching.
  4. 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.

Dynobase is a Professional GUI Client for DynamoDB

Start your 7-day free trial today

Product Features

Download
/
Changelog
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2026 Dynobase
+
Still using AWS DynamoDB Console?
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.