[React Native] Problem with parseUrl in @aws-sdk/url-parser-node #1900
Labels
duplicate
This issue is a duplicate.
feature-request
New feature or enhancement. May require GitHub community feedback.
I'm using @aws-sdk/client-cognito-identity and @aws-sdk/credential-provider-cognito-identity to retrieve credentials from a Cognito Identity Pool to access AWS recourses from a React Native app.
The relevant code is:
Upon resolving the promise returned by fromCognitoIdentityPool, an error is thrown:
This seems to be cause by the line
aws-sdk-js-v3/packages/url-parser-node/src/index.ts
Line 5 in 982ad93
The problem is that React Native contains a homemade polyfill for URL (see also facebook/react-native#16434).
As a workaround, https://github.com/charpeni/react-native-url-polyfill can be used. If I include import "react-native-url-polyfill/auto"; in the file where the fromCognitoIdentityPool() function is located, it works. I think it would be good to solve this for React Native in @aws-sdk/url-parser-node, so that people don't need to deploy their own workarounds. I'd be happy to do pull request if pointed in the right direction, but right now I'm not sure how to solve this. I guess you probably don't want to include https://github.com/charpeni/react-native-url-polyfill in @aws-sdk/url-parser-node.
The text was updated successfully, but these errors were encountered: