-
Notifications
You must be signed in to change notification settings - Fork 176
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
Uncaught TypeError: querystring.escape is not a function #46
Comments
@tribou it's most likely the (incredibly old) version of querystring that webpack shims: https://github.com/webpack/node-libs-browser/blob/master/index.js – you can see there it's using I'd use this as a replacement: https://www.npmjs.com/package/querystring-browser |
Going to close this as it's an issue with the library that Webpack uses – feel free to reopen if you think there's a bug in |
For anyone running into this error with webpack, install querystring-browser and use below resolve in webpack.config.js:
|
@paolavness This didn't solve the issue for me. I ended up getting |
@Relequestual Try install querystring-browser as a local dependacy rather than global - |
Yup. I did try that. Sadly no dice still. Going to find an alternative solution. |
You don't want to change I made a fork just for making this work out of the box with create-react-app & webpack, for other people who are having the same problem: |
I used querystring.escape/unescape because it handles more cases: https://github.com/nodejs/node/blob/master/lib/querystring.js#L108-L194 If we can't find any cases for aws4 where the behavior is actually different though, I'd be very happy to remove them in favor of encodeURIComponent/decodeURIComponent |
None of the mocha tests failed when i changed to encodeURIComponent/decodeURIComponent. If there are some edge cases that will fail, then maybe we should have some tests that ensure this. I cannot think of any cases that will cause it to fail, though... |
By the way, there has been released a new version of underlying I have submitted a PR into Webpack project: webpack/node-libs-browser#70. As soon as we will manage to have this merged, the issue will be resolved. |
This makes it compatible with bundlers that don't provide querystring.escape. See here for details: mhart/aws4#46
I'm using webpack to bundle
aws4
, and when I set apath
other than/
, I get the following error:The stacktrace is pointing to
aws4/aws4.js
Line 228 in 0790ddc
I tried adding the following node config to webpack (to see if it would polyfill), but it didn't seem to change anything:
The text was updated successfully, but these errors were encountered: