generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Labels
Description
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
22.13.1
Amplify CLI Version
13.0.1
What operating system are you using?
Windows
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
I am getting the following error when following the Call a GraphQL API from a Lambda function on amplify mock function.
{
"statusCode": 400,
"body": "{\"data\":{\"listTodos\":null},\"errors\":[{\"path\":[\"listTodos\"],\"data\":null,\"errorType\":\"Unauthorized\",\"errorInfo\":null,\"locations\":[{\"line\":3,\"column\":5,\"sourceName\":null}],\"message\":\"Not Authorized to access listTodos on type Query\"}]}"
}My default authorization mode is set to IAM. Here's my schema.graphql:
type Todo @model @auth(rules: [{ allow: private, provider: iam }]) {
name: String
description: String
}Expected behavior
It should return a list of todo items.
Reproduction steps
- Follow the docs: Call a GraphQL API from a Lambda function
- Run
amplify mock function myfunction. - You will get the above error message.
Project Identifier
9e43d72a6f7f950e19659de7e5e77774
Log output
# Put your logs below this line
Ensuring latest function changes are built...
Starting execution...
(node:1476) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `amplify --trace-deprecation ...` to show where the warning was created)
EVENT: {"key1":"value1","key2":"value2","key3":"value3"}
✅ Result:
{
"statusCode": 400,
"body": "{\"data\":{\"listTodos\":null},\"errors\":[{\"path\":[\"listTodos\"],\"data\":null,\"errorType\":\"Unauthorized\",\"errorInfo\":null,\"locations\":[{\"line\":3,\"column\":5,\"sourceName\":null}],\"message\":\"Not Authorized to access listTodos on type Query\"}]}"
}
Finished execution.
Additional information
No response
Before submitting, please confirm:
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- I have removed any sensitive information from my code snippets and submission.