-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for ReadableStream body #50
Conversation
For those who realllllly can't wait (like myself), here's a published fork: https://www.npmjs.com/package/@aimoda/aws4fetch |
To be clear, you can set the |
Agreed, I think this PR makes the behavior a bit more developer friendly. (I think most of us often use ReadableStreams because we don't want to buffer everything into memory.) |
I'm not convinced this works with every service though – in fact, I suspect it works with very few as, at least in the past, most services required fully hashed bodies. Happy to test it out though. Which services have you tested it on? |
I'm using it with Lambda Function URLs. https://docs.aws.amazon.com/lambda/latest/dg/urls-invocation.html#urls-payloads |
Right, that makes sense for that particular use case. But nearly every other AWS service uses fixed JSON/XML payloads as bodies, so using ReadableStreams will likely just get signature errors. I can test it out when I get some time, but I don't think this should go in as is – at the very least the documentation should be updated to highlight that users might get errors if they use streams. |
Nope, I am 100% wrong. It does not work with Lambda Function URLs like I claimed. Not sure why I thought it was working. |
Hi @mhart This error is thrown when the request body is a Lines 328 to 330 in 629b108
I guess this makes sense as this check requires the payload to be signed. However, I'm wondering:
Apologies if some of this is out of scope, but I'm very new to this whole signing concept and haven't really worked with Also thanks for making this library! |
I think we ended up just converting to an ArrayBuffer and avoided using ReadableStream objects in our Cloudflare Workers. |
Ah appreciate the reply that's what I ended up doing |
This is quite important for us folks using aws4fetch in a CF Worker in bundled billing mode.
Fixes #36