this is my function
async function generateImage() {
try {
const response = await openai.createImage({
prompt: 'a white siamese cat',
n: 1,
size: '1024x1024',
});
console.log(response);
} catch (error) {
console.error(error);
}
}
i am getting this error when using on mobile :
Error: URL.search is not implemented
i am really stuck in this one so any help is appreciated
2
Answers
i found the solution you have to install npm install react-native-url-polyfill and import "react-native-url-polyfill/auto" in your App.js
You should use react-native-url-polyfill. It’s a homemade
polyfill
to implement the URL API.or
At the top of your entry-point file
(index.js)
, the polyfill will be automatically applied.Then just use the url api in any files without any
import
I hope it will help 🙂