You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Runtime: NodeJS 18
Library Version: 0.12.2
Workaround: Use double quotes for strings in filterByFormula
I have a filterByFormula that is 13283 characters long when unencoded. It's a long OR(...) function with hundreds of RECORD_ID()='recXXXXXXXXX' comparisons. When I attempt to run select and pass this filter formula I am getting the following:
After some digging I found that the issue is being caused by a discrepancy in the URL encoding of the single quotes around the record ids. Here the function encodeURIComponent encodes the URL without encoding single quotes resulting in a length of 15010. However, when node-fetch makes the API call, it internally encodes the URL with the single quotes encoded resulting in a longer URL length above the 16k char limit, hence the 414 error.
Making the following change resolves the issue for me but there may be a better solution:
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
to parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value).replace(/'/g, "%27")}`);
The text was updated successfully, but these errors were encountered:
Runtime: NodeJS 18
Library Version: 0.12.2
Workaround: Use double quotes for strings in filterByFormula
I have a filterByFormula that is 13283 characters long when unencoded. It's a long OR(...) function with hundreds of RECORD_ID()='recXXXXXXXXX' comparisons. When I attempt to run
select
and pass this filter formula I am getting the following:AirtableError { error: 'UNEXPECTED_ERROR', message: 'An unexpected error occurred', statusCode: 414 }
After some digging I found that the issue is being caused by a discrepancy in the URL encoding of the single quotes around the record ids. Here the function
encodeURIComponent
encodes the URL without encoding single quotes resulting in a length of 15010. However, when node-fetch makes the API call, it internally encodes the URL with the single quotes encoded resulting in a longer URL length above the 16k char limit, hence the 414 error.Making the following change resolves the issue for me but there may be a better solution:
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
to
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value).replace(/'/g, "%27")}`);
The text was updated successfully, but these errors were encountered: