dynobase-icon
Dynobase

Error: DynamoDB Scan Not Working

Rafal Wilinski

Answered by Rafal Wilinski

Last updated: October 23rd, 2026

Solution

A single Scan request reads only one page, up to its Limit or the service's 1 MB page boundary, then applies the filter. An empty Items array can therefore still have a LastEvaluatedKey and more data to read.

import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, ScanCommand } from "@aws-sdk/lib-dynamodb";

const db = DynamoDBDocumentClient.from(new DynamoDBClient({}));

let key;
do {
  const page = await db.send(new ScanCommand({
    TableName: "Orders",
    ExclusiveStartKey: key,
  }));
  for (const item of page.Items ?? []) console.log(item);
  key = page.LastEvaluatedKey;
} while (key && Object.keys(key).length > 0);

Use the returned key unchanged as ExclusiveStartKey with the same query settings. Count and ScannedCount describe the current page, not the whole table. Limit caps evaluated items before filtering.

If no items match, check the filter values and types, index projection, account, Region and endpoint. If a request throws, handle its actual permission, throttling or validation error. Scans can consume substantial read capacity; use Query for an indexed access pattern and avoid loading an entire large table into memory. Even a strongly consistent scan is not a snapshot of all items at one instant.

See pagination 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.