-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
AmazonAIPredictions provider gives a Cant't find variable: Buffer
error on a React Native app created with Expo
#9580
Comments
Something new here? I got the same error with aws-amplify@4.3.39. |
I am also experiencing this with aws-amplify@5.1.3 |
Hi @Sebas1245 @kchhan-ampa @julum following up here - a recent update for a different issue may have addressed this error related to Buffer. Could you try with the latest version of |
Hi @Sebas1245 @kchhan-ampa follow up here again. I have a potential work around for you and although it involves the uses a 3rd party dependency ( An example of how this looks like: import { toByteArray } from 'react-native-quick-base64';
const options = { quality: 0.7, base64: true };
const photo = await camera.current.takePictureAsync(options);
const bytes = toByteArray(photo.base64)
await Predictions.identify({
text: {
source: { bytes },
}
}) |
Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue. There is also a workaround provided in the comment above by @nadetastic should anyone else come across this issue. Thank you! |
Related to #12218 |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Predictions
Amplify Categories
predictions
Environment information
Describe the bug
I am using the Identify text library to detect text from an image. I tried using the bytes option on the source object to avoid having to set up the storage option and it gave me a
Cant't find variable: Buffer
error.Expected behavior
I am able to take a picture and the
Predictions.identify()
method returns a response.Reproduction steps
expo-cli
installed.expo
application.expo-camera
package and add the function described below to take pictures.Code Snippet
Log output
aws-exports.js
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
A workaround I found, at least to get the Predictions library to work with my logic was to place the following on the first line of the file
node_modules/@aws-amplify/predictions/lib-esm/Providers/AmazonAIIdentifyPredictionsProvider.js
:I am aware that this is not an acceptable solution but I hope this is helpful to figuring out what the fix would be.
The text was updated successfully, but these errors were encountered: