-
Notifications
You must be signed in to change notification settings - Fork 578
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
Getting FailedToFetch error for DynamoDBClient QueryCommand #6621
Comments
It is CORS issue, but the question is how comes it hasn't been before and how can it be resolved: Access to fetch at 'https://dynamodb.eu-north-1.amazonaws.com/' from origin 'https://XXXX.XXXX.XXX has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. |
Hey @renchix , There's some potential root causes:
To identify the patterns in the failures, you can implement detailed logging to include the timestamps and full request details and response headers. To help potentially resolve this issue, you can apply retry logic: const MAX_RETRIES = 3;
const RETRY_DELAY = 1000; This can help mitigate intermittent issues. Thanks! |
Thanks for the detailed response. To my understanding default in-built retry mechanism () already makes 3 attempts after failed request, so it seems that this doesn't solve the issue as it should already be working. Caching errors seems to be a possible cause, however, as we have seen cases where even after trying to fully refresh page for several times error still persists, then this also doesn't feel as the likely cause. I could hope that this ir really some temporary issue - the fact that 99.9% of time everything works correctly also kind of supports this logic. However, I am still puzzled about the fact that in the last week there have been multiple such cases, without anything similar before. Also, in those cases where DynamoDBClient keeps failing Lambda Client works without issues (I understand that there the logic is a bit different - but still it goes under aws-sdk which then makes causes #1 and #4 as less likely) - this also make me feel that this is some issue specific to DynamoDBClient. |
Thanks for the updates! I agree, and also it's hard to troubleshoot to find the root cause as it works well in 99.9% of time. I have asked Dynamo DB team and see if there's any known issue happened last week in your region. |
Still getting the same error every day or two:
main.535af7c7.js:2
Is there some way to force those headers for DynamoDBClient request in our React code? |
To me it seems that only solution then is to do all requests through API gateway (not directly to DynamoDB as it is now) |
To add maybe a little bit more context for DynamoDB team - even if QueryItems fails and then problem persists for some time - at the same time GetItem requests are fulfilled. |
After some additional investigation I found that preflight request is made and received successfully, however the real request in those failed cases is missing 'Remote address' in the Headers. Preflight requests for both of them seem to be identical. @zshzbh any suggestions? |
Hey @renchix , I can't reproduce this error. Could you please provide any pre-condition and minimal code reproduction so we can better troubleshoot this issue? |
There is not much of code to provide.
As error usually comes by surprise, I cannot reliably reproduce it as well. |
Checkboxes for prior research
Describe the bug
Fetching data from DynamoDB through QueryCommand ocasionally results in FailedToFetch error. Error persists temporarily and comes and goes periodically. First cases were observed in Oct 31, 2024 and Nov 1, 2024. And again today.
Regression Issue
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Browser
Details of the browser/Node.js/ReactNative version
Microsoft Edge
Reproduction Steps
Observed Behavior
Code has been working for at least a year, no changes have been made recently.
First idea was that it some how related to CORS, but I am not sure if this can somehow be configured for DynamoDBClient.
Expected Behavior
DyanmoDb results should be fetched without raising error.
Possible Solution
No response
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: