Skip to content
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

Error: URL.hostname is not implemented in React Native AWS Textract integration #6191

Closed
3 tasks done
ketan-pcs opened this issue Jun 12, 2024 · 3 comments
Closed
3 tasks done
Assignees
Labels
closed-for-staleness guidance General information and guidance, answers to FAQs, or recommended best practices/resources. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Comments

@ketan-pcs
Copy link

ketan-pcs commented Jun 12, 2024

Checkboxes for prior research

Describe the bug

I'm encountering an error while integrating AWS Textract with a React Native application. When attempting to analyze an ID document using the AnalyzeIDCommand from the @aws-sdk/client-textract package, I'm receiving the following error message:
[Error: URL.hostname is not implemented]

SDK version number

3.592.0

Which JavaScript Runtime is this issue in?

React Native

Details of the browser/Node.js/ReactNative version

0.74.1

Reproduction Steps

[Error: URL.hostname is not implemented]

Observed Behavior

 const textRactFunction = async () => {
    if (imageData?.data) {
      const client = new TextractClient({
        region: 'us-east-1',
        credentials: {
          accessKeyId: 'YOUR_ACCESS_KEY_ID',
          secretAccessKey: 'YOUR_SECRET_ACCESS_KEY',
        },
      });

      const blob = Buffer.from(imageData?.data, 'base64');

      const params = {
        DocumentPages: [
          {
            Bytes: blob,
          },
        ],
      };

      const command = new AnalyzeIDCommand(params);

      try {
        const textRactData = await client.send(command);

        // process data.

         console.log(textRactData.IdentityDocuments[0].IdentityDocumentFields);
      } catch (error) {
        console.log('TextractClient err', error);
        // error handling.
      }
    }
  };

Expected Behavior

give a response

Possible Solution

No response

Additional Information/Context

No response

@ketan-pcs ketan-pcs added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 12, 2024
@RanVaknin
Copy link
Contributor

Hi @ketan-pcs ,

Did you add any polyfills?

If you are consuming modular AWS SDK for JavaScript on react-native environments, you will need to add and import following polyfills in your react-native application:

react-native-get-random-values
react-native-url-polyfill

import "react-native-get-random-values";
import "react-native-url-polyfill/auto";

Thanks,
Ran~

@RanVaknin RanVaknin self-assigned this Jun 17, 2024
@RanVaknin RanVaknin added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. guidance General information and guidance, answers to FAQs, or recommended best practices/resources. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. bug This issue is a bug. labels Jun 17, 2024
Copy link

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jun 28, 2024
@github-actions github-actions bot closed this as completed Jul 2, 2024
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
closed-for-staleness guidance General information and guidance, answers to FAQs, or recommended best practices/resources. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants