Comments (3)
The problem with these sorts of errors is you don't know whether they're safe to retry or not (or at least, aws4fetch wouldn't know generally). Eg, you might accidentally send duplicate messages over SNS or SQS, etc, etc.
It's possible I could introduce an opt-in option for it though. Aside from this error, are there any others you've observed?
from aws4fetch.
I've been using aws4fetch for at least a few years and I don't recall ever seeing it throw an exception for anything other than network errors. The MDN documentation page for fetch
lists the reasons an exception might thrown, and network errors appears to be the only scenario listed that would warrant a retry.
In my case, I usually only see occasional instances of a single network error log appear even though the Cloudflare worker is normally being invoked multiple times per second (and always calls to AWS). So, retrying these AWS requests resulting in network errors would almost certainly be successful.
I suspect the majority of AWS calls are reads/writes to resources where a duplicate read/write would not cause an issue, and therefore, a retry on network error would be very desirable. In the scenarios you mentioned where a duplicate AWS call would be a problem, I think most devs would want to retry and deal with potential duplication issues on the AWS side. Otherwise, the dev has to choose between either not retrying or else attempting to communicate further with AWS to determine whether a retry is safe, neither of which seems like an optimal solution. In my case, I ignored the network errors, but only because the worker is performing non-critical work where a few dropped AWS calls per month is an insignificant issue. However, I will soon begin using aws4fetch for new high traffic Cloudflare workers whose work will be more critical, which has prompted me to finally look into the network errors.
If aws4fetch was new, and not yet released, I think retrying on network errors by default, while also providing an opt-out option, would be the most desirable choice. However, I can understand that you might be concerned about potential unintended consequences of making such a change given that aws4fetch is already in use. So, as you suggested, perhaps a new opt-in option is best. I'm sure whatever solution you might consider would be appreciated by us aws4fetch fans. :-) Thank you for listening.
from aws4fetch.
@bflora2 What I recommend doing, is using .sign
from aws4fetch, and then implementing whatever retry logic you want "normally".
from aws4fetch.
Related Issues (20)
- sign and fetch functions don't *exactly* match TypeScripts' types.
- Lambda Function URL decoding HOT 5
- Providing custom headers when using signQuery results in incorrect SignedHeaders HOT 8
- How to use it with React Native? HOT 1
- InvalidSignatureException on redirect fetch in CF Worker HOT 2
- Race condition with ReadableStream
- Sign URLs without protocol HOT 3
- POST with empty body
- BUG: aws4fetch.authHeader excluding "content-length" and "content-type" HOT 1
- Typescript/export/module/package.json B.S. HOT 14
- Google cloud storage compatability
- crypto is not defined HOT 9
- Could not find a declaration file for module 'aws4fetch' HOT 3
- Feat: Make execute-api default service for API Gateway with custom URL HOT 3
- Error code not provided when goes to catch block for fetch request HOT 17
- X-Amz-Content-Sha256 not being generated HOT 3
- How to use this in a lambda? HOT 4
- headers keys change from camel case to first letter upper case and rest lowercase HOT 1
- Not working in SvelteKit? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws4fetch.