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

[Amplify Admin Actions] CORS error and unable to pass queryStringParameters #13259

Open
3 tasks done
muvashi opened this issue Apr 17, 2024 · 3 comments
Open
3 tasks done
Assignees
Labels
API Related to REST API issues documentation Related to documentation feature requests

Comments

@muvashi
Copy link

muvashi commented Apr 17, 2024

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

REST API

Amplify Version

v6

Amplify Categories

api

Backend

None

Environment information

NA

Describe the bug

  1. On trying to pass Authorization header as mentioned in below example, the following error occurs.

https://docs.amplify.aws/javascript/build-a-backend/auth/admin-actions/#example

Access to fetch at 'https://aaaa.execute-api.us-east-1.amazonaws.com/dev/listGroups' from origin 'http://localhost:3001' 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.

  1. On trying to pass query string parameters using the above example, no error occurs but the parameters are not passed in request URL and they are not visible in the Lambda function event.

Expected behavior

  1. No CORS error.
  2. Query string parameters should be passed in the request.

Reproduction steps

Follow the above mentioned docs

Code Snippet

No response

Log output

// Put your logs below this line


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

@muvashi muvashi added the pending-triage Issue is pending triage label Apr 17, 2024
@muvashi
Copy link
Author

muvashi commented Apr 17, 2024

Submitted PR to fix both these behaviour :- PR7234

@cwomack cwomack added the API Related to REST API issues label Apr 17, 2024
@cwomack cwomack self-assigned this Apr 17, 2024
@cwomack cwomack added documentation Related to documentation feature requests and removed pending-triage Issue is pending triage labels Apr 17, 2024
@ShaimaaHamdan
Copy link

I am facing same issue after upgrading to Amplify V6
image

@muvashi
Copy link
Author

muvashi commented Apr 21, 2024

@ShaimaaHamdan Please check the PR aws-amplify/docs#7234

muvashi added a commit to muvashi/docs that referenced this issue May 10, 2024
muvashi added a commit to muvashi/docs that referenced this issue May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to REST API issues documentation Related to documentation feature requests
Projects
None yet
Development

No branches or pull requests

3 participants