node-dynamodb-stream
node-dynamodb-stream copied to clipboard
ResourceNotFoundException if shard does not exist
We persist the stream's shard state periodically. When the service restarts, it loads the last known shard state. Occasionally this throws an error if the saved state contains a shard, which no longer exists:
22021-07-02T02:15:08.675Z (node:7) UnhandledPromiseRejectionWarning: ResourceNotFoundException: Requested resource not found: Shard does not exist
32021-07-02T02:15:08.675Z at deserializeAws_json1_0GetShardIteratorCommandError (/var/app/node_modules/@aws-sdk/client-dynamodb-streams/dist/cjs/protocols/Aws_json1_0.js:240:41)
42021-07-02T02:15:08.675Z at runMicrotasks (<anonymous>)
52021-07-02T02:15:08.675Z at processTicksAndRejections (internal/process/task_queues.js:95:5)
62021-07-02T02:15:08.675Z at async /var/app/node_modules/@aws-sdk/middleware-serde/dist/cjs/deserializerMiddleware.js:6:20
72021-07-02T02:15:08.675Z at async /var/app/node_modules/@aws-sdk/middleware-signing/dist/cjs/middleware.js:12:24
82021-07-02T02:15:08.675Z at async StandardRetryStrategy.retry (/var/app/node_modules/@aws-sdk/middleware-retry/dist/cjs/StandardRetryStrategy.js:51:46)
92021-07-02T02:15:08.675Z at async /var/app/node_modules/@aws-sdk/middleware-logger/dist/cjs/loggerMiddleware.js:6:22
102021-07-02T02:15:08.675Z at async DynamoDBStream._getShardIterator (/var/app/node_modules/dynamodb-stream/index.js:150:29)
112021-07-02T02:15:08.675Z at async dispatch (/var/app/node_modules/@kessler/async-map-limit/impl.js:30:22)
I think the client should just ignore such errors and remove the shard from its list.