'URL.hostname is not implemented
I'm looking for some help on my textract client project. I am trying to follow the AWS Textract documentation, but I am stuck at the textractClient.send(). I am getting the error URL.hostname is not implemented
I have followed the steps on AWS to set up my IAM, S3, and I have updated my ~/.aws/config and credentials files. I left out a couple of fields but here's my code:
import { AnalyzeExpenseCommand } from "@aws-sdk/client-textract";
import { TextractClient } from "@aws-sdk/client-textract";
...
const textractClient = new TextractClient({ region: 'us-east-1' });
const bucket = 'scannsplit-s3-bucket'
const photo = 'Sojuba.png'
// Set params
const params = {
Document: {
S3Object: {
Bucket: bucket,
Name: photo
},
},
}
...
const process_text_detection = async () => {
try {
const aExpense = new StartExpenseAnalysisCommand(params);
console.log(aExpense);
const response = await textractClient.send(aExpense);
console.log(response);
return response; // For unit tests.
} catch (error) {
console.log('Error: ' + error);
}
}
...
process_text_detection() is being called with a button
What I've tried: I came across this other post Error "URL.hostname is not implemented", AWS SNS in React Native Android that seems to have a similar issue. I tried the solution and after I installed react-native-url-polyfill and react-native-get-random-values, I got the error Native module is not found. I tried looking for fixes for that error but also did not have much luck.
Any help is much appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
