Closed hisham closed 10 months ago
we are having the same issue.
I am getting this in react...it is blocking our tests from running in cypress...any updates?
still getting this issue. any updates?
@hisham, can you clarify what calls are being made when this occurs? I've seen this error pop up in different issues, but it's notorious for being difficult to reproduce without more information about the specific calls being made or more information about your environment. Usually this happens with Storage or Auth libraries in particular, so can you confirm if you're using either of those?
It doesn't appear to be specific to Angular per @GeorgeBellTMH's comment about experiencing this in React as well, but I'm having trouble reproducing this reliably.
Possibly related issues: #10381 #10809 (and quite a few closed issues)
Hi @cwomack - my apologies for delay in responding. The error always happens after a call to cognito (see attached screenshot). It's happening for a minority of users once every day or few days.
This part of our app where this error occurs is public btw. It happens in these urls - https://www.essentialclinic.ca/hair-loss-visit and https://www.essentialclinic.ca/ed-visit. Network requests to API Gateway and Pinpoint are made in these pages, and user also uploads photos to an s3 guest bucket (public write, no read). No authentication is required for these requests. However I think the loading of the S3 storage service in aws-amplify triggers the call to cognito as it needs an identity id. And for some reason that call to cognito sometimes fails for some users, probably due to poor network connection on the user's part. You can see the call to cognito is made whenever these pages load in the below attached screenshot.
I hope this helps, let me know if anything else is needed.
@hisham, appreciate the reply and additional context. Are you able to share what your IAM permissions look like for the Cognito Identity Pool tied to unauthenticated users?
Yes I can share it but I should probably not post it publicly here. Is there an email like amplify-cli@amazon.com that I can send to?
@hisham, unfortunately there isn't a specific email address for the JS team or this repo at this point. However we can have customer calls through our Slack channels or even a screen share now through the Discord server for Amplify. Is there a preference you'd have between those?
Amplify has a Slack channel? I didn't know that. I prefer Slack but I'm on the Discord Amplify channel too - hisham#6667 is my username.
Discord would be preferred! I'll ping you on there to follow up on this further. Any workaround/solution we can post back on this issues (for anyone else that might be following).
Related to #11251
Any update here? This is affecting our production users as well.
In the meantime, has anyone figured out what the workaround is - would it be to force the users who encounter it to login again? Or could they just retry and it's random if it works?
Hey @TrekSoft. We don't have an update yet and are still trying to reproduce this issue reliably in order to find the source. Any additional context around specific steps to reproduce this issue, the methods being called, or especially a sample repo would be helpful.
Unfortunately we don't have specific steps and it seems to be an edge case when it happens but similar to @hisham it happens in two locations in our app where users are uploading an image to S3.
Here's what the engineer investigating it wrote:
We got this issue when trying to get the current session with Auth.currentSession(). This method will automatically get the accessToken and idToken from AWS Cognito. But we got an error while calling Cognito: "PreTokenGeneration invocation failed due to error Socket timeout while invoking Lambda function". And Amplify throws an error message "Cannot read property 'byteLength' of undefined
"
Any update on this? This has affected 9 users in the past 5 days and is a really horrible experience for them when it happens.
As some additional, potentially helpful information, on iOS it automatically triggers a logout but on Android it doesn't and all other actions the user attempts to take after that point fail with the same error.
Hi @TrekSoft following up here. Can you clarify what action is being attempted when this error occurs? For example, is the user attempting to get an object from Storage?
Hi @TrekSoft - let me know if you still need assistance with this issue.
Sorry yeah no more assistance needed here. We were attempting to read a file from s3 while the user's token was expired.
On Fri, Oct 6, 2023, 5:33 PM Dan Kiuna @.***> wrote:
Hi @TrekSoft https://github.com/TrekSoft - let me know if you still need assistance with this issue.
— Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-js/issues/9265#issuecomment-1751426974, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGZTBRUFSDPAH43RUBHLATX6B2LXAVCNFSM5IPWKVHKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZVGE2DENRZG42A . You are receiving this because you were mentioned.Message ID: @.***>
Hi @hisham following up here - let me know if you are still having this issue as it may have been related to missing permissions on the user.
haven't seen it in a while, so feel free to close, thanks!
@hisham, that's great to hear! We'll close this issue out then, but definitely take a look at our release announcement for the latest version of Amplify, migration guide, and documentation for more information.
Before opening, please confirm:
JavaScript Framework
Angular
Amplify APIs
REST API
Amplify Categories
api
Environment information
Describe the bug
Sentry in my web app is reporting the following error on a few Android devices: "Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'byteLength') TypeError: Cannot read properties of undefined (reading 'byteLength')"
It seems this error is thrown when the device has network issues - a bunch of get rest api and cognito requests return http status 0 sentry shows (no response).
It seems isEmptyData in the aws-crypto lib should handle the case where data is undefined and return true for that as well.
Expected behavior
Code shouldn't fail if there is network issue.
Reproduction steps
Unknown, I just see the error in Sentry (3 users so far), and they are all running Android.
Code Snippet
Log output
aws-exports.js
No response
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