-
-
Notifications
You must be signed in to change notification settings - Fork 935
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
beforeRequest
hook is not called before the actual request
#994
Comments
Could you post here the error that Got throws? |
It's not a specific Got error (I think it was something like "body, form and json are mutually exclusive" or something - because the v10 options passed to aws4 are mangled before Got processes them it's not surprising since most of the required options are missing due to incorrect concatenation of various options properties. It's easy to reproduce using the sample code for AWS. |
Thanks, will try it out. |
Can you try again with @reconbot Would you be able to look into this? |
Did some more testing with this today using 10.2.0. I can no longer reproduce the type/header mangling issue described above. However, it still doesn't play nicely with aws4. To start with aws4 is dependent on both the path and hostname options which were previously set automatically when using baseUrl - the change to prefixUrl means that these both now need to be specified in addition to prefixUrl. Even with this change though, despite aws4 setting the AWS authentication headers in the options, I think the change to the json/body handling in v10 is causing issues with the aws4 signature calculation, resulting in either 403 or 400 errors with AWS requests. I'm therefore having to stay on 9.6.0 and the sample code for aws4 integration should be commented as such. |
beforeRequest
is not called before the actual request
beforeRequest
is not called before the actual requestbeforeRequest
hook is not called before the actual request
You're right. After calling the |
cc @mhart I'm not able to take a look right now |
Ay? Why cc me? aws4 hasn't changed anything 🤷♂ |
I believe that OP was using |
I had some AWS API integrations using Got v9.6.0 that were working fine until the Got dependency was updated to 10.0.4 by the server when all of a sudden the integrations broke. Despite the updated example code for aws4 integration using prefixUrl which I updated to, it still didn't work. Further debugging revealed that not only was aws4 rejecting the v10 options object (complaining it was type object and not string), even if I passed it as a string instead, the resultant options object from aws4 was completely mangled (properties concatenated, etc.) - hence why the integrations broke. As soon as I reverted my code and the Got dependency to 9.6.0 again, everything was back to working fine.
aws4 compatibility may therefore be worth looking at (I'm guessing this is commonly used) as well as the example shown at https://github.com/sindresorhus/got#aws - for now I'll therefore hold at 9.6.0
Thanks,
James
The text was updated successfully, but these errors were encountered: