brad | 2023-02-26 21:00:03 UTC | #1
Hi,
I am trying to retrieve a Contact List download from the AWS S3 bucket using the fetch API or Axios. Both return a CORS error when I try to fetch the file via the secure download URL returned by the DownloadAPI.
eg/ https://prod-apse2-dialer.s3.ap-southeast-2.amazonaws.com/contact-lists/exports/d09cbea4-1289-4c28-ae7f-3ad55a33baf5-ACC_CR_2.csv?response-content-disposition=attachment%3Bfilename%3D%22d09cbea4-1289-4c28-ae7f-3ad55a33baf5-ACC_CR_2.csv%22&X-Amz-Security-Token=I...........D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230226T193211Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Credential=ASIA3EQYLGB7U5R3FDMD%2F20230226%2Fap-southeast-2%2Fs3%2Faws4_request&X-Amz-Signature=11027cce7b8c8efadd86a71387d662be703017b7d1d8a491d
Whilst this URL works fine in a browser I can't use it programmatically without triggering a CORS request. Because the application in development is running on localhost it fails CORS with AWS.
Access to XMLHttpRequest at 'https://prod-apse2-dialer.s3.ap-southeast-2.amazonaws.com/contact-lists/exports/........' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource
Can anyone help me? How do we test this?
FYI - adding 'mode: "no-cors"' to the fetch doesn't help because then the response is not available in javascript.
Cheers Brad
doagcdialogflowcx | 2023-03-10 09:25:08 UTC | #2
Hi Brad, did you manage to solve the problem? I have exactly the same issue when trying to download an export of job for knowledge bases:
Access to fetch at 'https://knowledge-prod-euw1-eu-west-1.s3.eu-west-1.amazonaws.com/knowledge/exports/c013d491-ab6b-405a-.......' from origin 'https://mygithubURL' 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.
If I copy/paste the download URL in the browser, the file is downloaded.
tim.smith | 2023-03-10 16:09:02 UTC | #3
@doagcdialogflowcx please open a case with Genesys Cloud Care to report the CORS issue with the download. This is not something that can be investigated via the forum. My guess is that this is a configuration problem with the S3 bucket, which will require a defect to be logged and a code change to be made, which can only be initiated via Care. Each customer report raises the priority of the issue; more impactful issues are generally prioritized higher.
system | 2023-04-10 16:09:18 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 18596