-
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
AWSS3Provider - get signed url error [TypeError: Cannot read property 'byteLength' of undefined] #10405
Comments
This call is also failing: await Auth.currentCredentials() .. returns undefined even though... await Auth.currentAuthenticatedUser() is returning the data. |
I explored this further ... const identityPoolId = awsconfig.aws_cognito_identity_pool_id; 5:06 |
@Qruiser Can you send the contents of |
i was working correctly with my app an dashboard cognito admin panel, but suddenly appears the same issue when i try to upload or get image file from s3 bucket to my avatar profile users, imported s3 storage, with default settings to log users. |
This is my cli-inputs.json{ FYI , I further investigated the issue and did the following experiment...const identityPoolId = awsconfig.aws_cognito_identity_pool_id; with this output:on Android: us-east-1:7632617d-e8f1-4946-b5aa-XXXXXX |
@Qruiser I noticed that your code looks like you are using the SDK. Are you using the SDK for Auth instead of Amplify Auth? |
I am using Amplify Auth. I have been able to reproduce it on a plain vanilla react-native 0.70 project using Fabric and Hermes. The GetIdCommand on vanilla React native 0.70 works without Fabric option. I think there is something going wrong here. Maybe too early to try this with aws-amplify. |
Same issue here, it's working on my amplify environment dev but not on staging... and I don't see and difference between both environments... |
If you can create and share a repo that reproduces the issue please share it with @tannerabread. We need to be able to reproduce the issue to figure out why it's happening. This exact error has come up for several different customers for different reasons so it's hard to tell without a close copy of your amplify configuration and logic. The easiest way to "force" this error is trying to put/get files as a guest (IAM) user without having allowed guest access and/or enabled unauthenticated logins. But if it's working in one platform or environment and not another, it's probably not that straightforward. |
@Qruiser I was able to reproduce this with Fabric enabled. Currently talking to the team to figure out next steps and will update this issue. @MensurRasic did you have Fabric enabled in your project? |
Labeling this as a bug with Fabric. This should be supported and will be looked into by the team. |
I was able to reproduce this issue, and as @Qruiser pointed out, this issue does seem to be isolated to iOS with the new architecture enabled. I dug into this and, unfortunately, I think the fix may have to come from React Native - I will try to open an issue there to learn more. In the meantime, my findings:
Having root caused this, I tried to better understand why the
This is where my investigation has brought me thus far. As to why the global Blob fails to construct, it seems to have something to do with React Native's NativeBlobModule as the construction error thrown can be traced back to the BlobManager Edit: Opened issued against React Native repo here |
Update to this issue: The fix to the underlying blob issue will be released to react native v0.71 which is scheduled to come out in a few weeks. Read more in this comment. This should allow us to verify if there is anything we need to do from the Amplify library side to resolve this error |
Hi @Qruiser, @killyvera, @MensurRasic I have tested it with my original app that reproduced the issue and upgraded following their upgrade helper. The issue seems to be resolved from my testing, can one of you test your own app to make sure. |
Closing this as resolved. The fix from the React Native side should be the solution for anyone running into this |
@tannerabread @chrisbonifacio package.json "dependencies": {
"@hookform/resolvers": "^2.9.11",
"@react-native-async-storage/async-storage": "^1.17.11",
"@react-native-community/netinfo": "^9.3.7",
"@react-navigation/native": "^6.1.4",
"@react-navigation/native-stack": "^6.9.10",
"@types/uuid": "^9.0.1",
"amazon-cognito-identity-js": "^6.1.2",
"aws-amplify": "^5.0.15",
"constate": "^3.3.2",
"native-base": "^3.4.25",
"react": "18.2.0",
"react-hook-form": "^7.43.1",
"react-native": "0.71.3",
"react-native-inappbrowser-reborn": "^3.7.0",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "^3.20.0",
"react-native-svg": "12.1.1",
"react-query": "^3.39.3",
"uuid": "^9.0.0",
"zod": "^3.20.6"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native-community/eslint-config": "^3.2.0",
"@tsconfig/react-native": "^2.0.2",
"@types/jest": "^29.4.0",
"@types/react": "^18.0.28",
"@types/react-native": "^0.71.3",
"@types/react-test-renderer": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"babel-jest": "^29.2.1",
"eslint": "^8.38.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-native": "^4.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.73.7",
"prettier": "^2.8.7",
"react-test-renderer": "18.2.0",
"typescript": "4.8.4"
}, code snippet Amplify.configure({
Auth: {
identityPoolId: awsExports.aws_cognito_identity_pool_id,
region: awsExports.aws_cognito_region,
userPoolId: awsExports.aws_user_pools_id,
userPoolWebClientId: awsExports.aws_user_pools_web_client_id,
},
oauth: {
...awsExports.oauth,
urlOpener,
},
Storage: {
AWSS3: {
bucket: awsExports.aws_user_files_s3_bucket,
region: awsExports.aws_user_files_s3_bucket_region,
},
},
API: {
aws_appsync_graphqlEndpoint: awsExports.aws_appsync_graphqlEndpoint,
aws_appsync_region: awsExports.aws_appsync_region,
aws_appsync_authenticationType: awsExports.aws_appsync_authenticationType,
}
});
await Auth.signIn({
username,
password,
});
const currentCredentials = await Auth.currentCredentials();
console.log({currentCredentials});
const result = await Storage.get(fileName, {
level: 'private',
});
console.log(result); console output LOG Running "flik" with {"rootTag":11}
LOG {"currentCredentials": [Error: Native module not found]}
WARN [WARN] 26:22.503 AWSS3Provider - get signed url error [TypeError: Cannot read property 'byteLength' of undefined]
WARN Possible Unhandled Promise Rejection (id: 0):
TypeError: Cannot read property 'byteLength' of undefined
TypeError: Cannot read property 'byteLength' of undefined
at isEmptyData (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:105523:16)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:105214:78)
at hmac (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:346790:16)
at ?anon_0_ (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:346761:33)
at next (native)
at asyncGeneratorStep (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:1195:26)
at _next (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:1214:29)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:1219:14)
at tryCallTwo (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/4b1t586k/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:61:9)
at doResolve (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/4b1t586k/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:216:25)
at Promise (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/4b1t586k/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:82:14)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:1211:25)
at apply (native)
at getSigningKey (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:346777:24)
at getSigningKey (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:347069:86)
at ?anon_0_ (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:346902:155)
at next (native)
at asyncGeneratorStep (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:1195:26)
at _next (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:1214:29)
at tryCallOne (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/4b1t586k/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:53:16)
at anonymous (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/4b1t586k/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:139:27)
at apply (native)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:26322:26)
at _callTimer (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:26241:17)
at _callReactNativeMicrotasksPass (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:26271:17)
at callReactNativeMicrotasks (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:26434:44)
at __callReactNativeMicrotasks (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:2591:46)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:2403:45)
at __guard (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:2575:15)
at flushedQueue (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:2402:21)
at callFunctionReturnFlushedQueue (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flik&modulesOnly=false&runModule=true:2387:33) |
@tannerabread @chrisbonifacio |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication, Analytics, GraphQL API, Storage, Push Notifications
Amplify Categories
No response
Environment information
Describe the bug
I am trying to get Storage.get in IOS Devices. This works on Android devices.
I get the following error:
WARN [WARN] 53:15.437 AWSS3Provider - get signed url error [TypeError: Cannot read property 'byteLength' of undefined]
Expected behavior
Should return a pre-signed URL.
Reproduction steps
Just try and do a storage.get on a key in IOS.
Code Snippet
Log output
aws-exports.js
/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
const awsmobile = {
"aws_project_region": "us-east-1",
"aws_cognito_identity_pool_id": "us-east-1:c3199a44-83da-4ec3-91a6-3f17fa52c7be",
"aws_cognito_region": "us-east-1",
"aws_user_pools_id": "us-east-1_3jP8B4fd3",
"aws_user_pools_web_client_id": "39h0kmgv6272ob133sebskl55p",
"oauth": {},
"aws_cognito_username_attributes": [
"EMAIL"
],
"aws_cognito_social_providers": [],
"aws_cognito_signup_attributes": [
"EMAIL"
],
"aws_cognito_mfa_configuration": "OFF",
"aws_cognito_mfa_types": [
"SMS"
],
"aws_cognito_password_protection_settings": {
"passwordPolicyMinLength": 8,
"passwordPolicyCharacters": []
},
"aws_cognito_verification_mechanisms": [
"EMAIL"
],
"aws_appsync_graphqlEndpoint": "https://uqzlz4lhqzchval73nuv3mcfhi.appsync-api.us-east-1.amazonaws.com/graphql",
"aws_appsync_region": "us-east-1",
"aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS",
"aws_appsync_apiKey": "da2-XXXXXXXXXXXX",
"aws_mobile_analytics_app_id": "XXXXXXXXXXXXX",
"aws_mobile_analytics_app_region": "us-east-1",
"aws_user_files_s3_bucket": "qapp-develop195252-develop",
"aws_user_files_s3_bucket_region": "us-east-1"
};
export default awsmobile;
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
No response
The text was updated successfully, but these errors were encountered: