aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.05k stars 573 forks source link

[React Native] environment failing with "Not implemented" #873

Closed Amplifiyer closed 4 years ago

Amplifiyer commented 4 years ago

Describe the bug The URL used here https://github.com/aws/aws-sdk-js-v3/blob/4a23bb45b036881953de9edad48cb779f4881903/packages/url-parser-browser/src/index.ts#L5 doesn't have full support in ReactNative libraries and throw "Not Implemented". See https://github.com/facebook/react-native/blob/0.60-stable/Libraries/Blob/URL.js#L153-L191

I tried polyfilling URL object with other mechanism but it has been complicated and so far not successful.

SDK version number

Latest alpha versions of aws-sdk

Is the issue in the browser/Node.js? ReactNative

Details of the browser/Node.js version Paste output of npx envinfo --browsers or node -v

To Reproduce (observed behavior) Run a app in react native and call cognito.

Expected behavior aws-sdk should be compatible across platforms.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

AllanZhengYP commented 4 years ago

@Amplifiyer Can you try swapping the url parser to Node one in the client for react native? For example:

import {parseUrl} from "@aws-sdk/url-parser-node";
const client = new S3Client({
    urlParser: parseUrl
});

This might import the node url parser pollyfill and fix the issue. We need the verification to further solve the issue.

Amplifiyer commented 4 years ago

@AllanFly120 I tried your workaround and it did work and I'm not seeing any errors with URL now.

AllanZhengYP commented 4 years ago

Fixed in: https://github.com/aws/aws-sdk-js-v3/releases/tag/v1.0.0-alpha.22

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.