Skip to content
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

Fetch errors are swallowed without logs #11694

Open
3 tasks done
villelahdenvuo opened this issue Jul 31, 2023 · 2 comments
Open
3 tasks done

Fetch errors are swallowed without logs #11694

villelahdenvuo opened this issue Jul 31, 2023 · 2 comments
Assignees
Labels
amazon-cognito-identity-js Used for issues related to this specific package within the monorepo Core Related to core Amplify issues feature-request Request a new feature

Comments

@villelahdenvuo
Copy link

villelahdenvuo commented Jul 31, 2023

Before opening, please confirm:

JavaScript Framework

Not applicable

Amplify APIs

Authentication, GraphQL API

Amplify Categories

auth, api

Environment information

Tested in Chrome with latest Amplify packages.

Describe the bug

Amplify JS SDK swallows fetch errors and simply throws "Network error", even if no network request is ever done. Nothing is logged, unless you turn on DEBUG level logging you see the Auth fetch request fails.

Expected behavior

Actual error message is thrown or the very least an error level log is written.

Reproduction steps

  1. Start up an Amplify project (I couldn't find any live demos...)
  2. Set log level to DEBUG
  3. Override window.fetch and make it throw an error
  4. Observe Amplify DEBUG log "Network error" with no details.

Code Snippet

No response

Log output

Screenshot 2023-07-28 at 12 05 08

aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

.

Mobile Browser Version

No response

Additional information and screenshots

I fixed the error in the fetch request, but finding the error was not easy as I had to spend time debugging a "Network error" even though there was nothing in the DevTools Network tab.

@villelahdenvuo villelahdenvuo added the pending-triage Issue is pending triage label Jul 31, 2023
@cwomack cwomack added aws-sdk-js investigating This issue is being investigated labels Jul 31, 2023
@cwomack cwomack self-assigned this Aug 1, 2023
@cwomack cwomack removed the pending-triage Issue is pending triage label Aug 1, 2023
@cwomack
Copy link
Member

cwomack commented Aug 1, 2023

Hello @villelahdenvuo, and thank you for opening this issue. Based on the comments logged within that screenshot, it looks like we might have this marked on as a known "To Do" to improve the error handling. I'll review this internally and report back soon!

@cwomack cwomack added amazon-cognito-identity-js Used for issues related to this specific package within the monorepo and removed aws-sdk-js labels Aug 1, 2023
@villelahdenvuo
Copy link
Author

@cwomack Hey, I saw the TODO-comment, but I thought I'd raise it also in case it has been missed. Since I did have to spend some hours debugging this, I thought I'd let you know. 😄

@cwomack cwomack added Core Related to core Amplify issues feature-request Request a new feature and removed investigating This issue is being investigated labels Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
amazon-cognito-identity-js Used for issues related to this specific package within the monorepo Core Related to core Amplify issues feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

2 participants