Skip to content

Commit 1f9d70b

Browse files
committed
[BUG] Airtable triggers are getting OOM
1 parent ab13d4e commit 1f9d70b

File tree

6 files changed

+29
-23
lines changed

6 files changed

+29
-23
lines changed

components/airtable_oauth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/airtable_oauth",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "Pipedream Airtable (OAuth) Components",
55
"main": "airtable_oauth.app.mjs",
66
"keywords": [

components/airtable_oauth/sources/common/common.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export default {
1717
"baseId",
1818
],
1919
},
20+
maxRecords: {
21+
type: "integer",
22+
label: "Maximum Records Per Execution",
23+
description: "Set a maximum number of records to fetch per execution if your trigger is failing",
24+
optional: true,
25+
},
2026
},
2127
hooks: {
2228
activate() {
@@ -42,5 +48,16 @@ export default {
4248
const formattedTimestamp = new Date(timestampMillis).toISOString();
4349
this._setLastTimestamp(formattedTimestamp);
4450
},
51+
getListRecordsParams(params) {
52+
const lastTimestamp = this._getLastTimestamp();
53+
return {
54+
filterByFormula: `LAST_MODIFIED_TIME() > "${lastTimestamp}"`,
55+
returnFieldsByFieldId: this.returnFieldsByFieldId || false,
56+
...(this.maxRecords && {
57+
maxRecords: this.maxRecords,
58+
}),
59+
...params,
60+
};
61+
},
4562
},
4663
};

components/airtable_oauth/sources/new-modified-or-deleted-records/new-modified-or-deleted-records.mjs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "New, Modified or Deleted Records",
77
description: "Emit new event each time a record is added, updated, or deleted in an Airtable table. Supports tables up to 10,000 records",
88
key: "airtable_oauth-new-modified-or-deleted-records",
9-
version: "0.0.8",
9+
version: "0.0.9",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {
@@ -53,10 +53,7 @@ export default {
5353
const prevAllRecordIds = this._getPrevAllRecordIds();
5454

5555
const lastTimestamp = this._getLastTimestamp();
56-
const params = {
57-
filterByFormula: `LAST_MODIFIED_TIME() > "${lastTimestamp}"`,
58-
returnFieldsByFieldId: this.returnFieldsByFieldId || false,
59-
};
56+
const params = this.getListRecordsParams();
6057

6158
const records = await this.airtable.listRecords({
6259
baseId,

components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "New or Modified Records in View",
77
description: "Emit new event for each new or modified record in a view",
88
key: "airtable_oauth-new-or-modified-records-in-view",
9-
version: "0.0.9",
9+
version: "0.0.10",
1010
type: "source",
1111
props: {
1212
...base.props,
@@ -48,11 +48,9 @@ export default {
4848
} = this;
4949

5050
const lastTimestamp = this._getLastTimestamp();
51-
const params = {
51+
const params = this.getListRecordsParams({
5252
view: viewId,
53-
filterByFormula: `LAST_MODIFIED_TIME() > "${lastTimestamp}"`,
54-
returnFieldsByFieldId: this.returnFieldsByFieldId || false,
55-
};
53+
});
5654

5755
const records = await this.airtable.listRecords({
5856
baseId,

components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "New Records in View",
77
description: "Emit new event for each new record in a view",
88
key: "airtable_oauth-new-records-in-view",
9-
version: "0.0.8",
9+
version: "0.0.9",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {
@@ -49,11 +49,10 @@ export default {
4949
} = this;
5050

5151
const lastTimestamp = this._getLastTimestamp();
52-
const params = {
52+
const params = this.getListRecordsParams({
5353
view: viewId,
5454
filterByFormula: `CREATED_TIME() > "${lastTimestamp}"`,
55-
returnFieldsByFieldId: this.returnFieldsByFieldId || false,
56-
};
55+
});
5756

5857
const records = await this.airtable.listRecords({
5958
baseId,

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)