Skip to content

Commit c7ccab8

Browse files
AWS DynamoDB - fix null shard iterator (#16000)
* recover if shard iterator becomes null * bump package.json * pnpm
1 parent 6b29c93 commit c7ccab8

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

components/aws/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/aws",
3-
"version": "0.7.5",
3+
"version": "0.7.6",
44
"description": "Pipedream Aws Components",
55
"main": "aws.app.mjs",
66
"keywords": [

components/aws/sources/new-dynamodb-stream-event/new-dynamodb-stream-event.mjs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "New DynamoDB Stream Event",
77
description: "Emit new event when a DynamoDB stream receives new events. [See the docs here](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_GetRecords.html)",
88
type: "source",
9-
version: "0.0.2",
9+
version: "0.0.3",
1010
dedupe: "unique",
1111
props: {
1212
...common.props,
@@ -36,6 +36,12 @@ export default {
3636
},
3737
hooks: {
3838
async deploy() {
39+
await this._getNewShardIterator();
40+
},
41+
},
42+
methods: {
43+
...common.methods,
44+
async _getNewShardIterator() {
3945
const { StreamDescription: streamDescription } = await this.listShards({
4046
StreamArn: this.stream,
4147
});
@@ -46,10 +52,8 @@ export default {
4652
ShardIteratorType: "LATEST",
4753
});
4854
this._setShardIterator(shardIterator);
55+
return shardIterator;
4956
},
50-
},
51-
methods: {
52-
...common.methods,
5357
_getShardIterator() {
5458
return this.db.get("shardIterator");
5559
},
@@ -71,7 +75,7 @@ export default {
7175
throw new Error("Stream is no longer enabled.");
7276
}
7377

74-
const shardIterator = this._getShardIterator();
78+
const shardIterator = this._getShardIterator() ?? (await this._getNewShardIterator());
7579

7680
const {
7781
Records: records, NextShardIterator: nextShardIterator,
@@ -84,6 +88,8 @@ export default {
8488
this.$emit(record, meta);
8589
}
8690

87-
this._setShardIterator(nextShardIterator);
91+
if (nextShardIterator) {
92+
this._setShardIterator(nextShardIterator);
93+
}
8894
},
8995
};

pnpm-lock.yaml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)