-
Notifications
You must be signed in to change notification settings - Fork 79
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
Not Authorized to access on type Mutation - 2 #2970
Comments
@chrisbonifacio I was able to get rid of the error by adding the authorization here: |
Hi @blipps199 ! thanks for the update. Can you check the network request that is being made from your application and share what the graphql query looks like? I'm curious to see the headers, input variables, the selection set (fields to be returned in the response), and how they compare to the AppSync console query. |
@chrisbonifacio After doing a bit more digging I can query and get data back... but not from a list query. Only from get queries where I have to filter using a specific id for the record. I haven't tried a mutation yet but that will be soon. |
@chrisbonifacio Here is the payload. {"query":"query ($demographic_data_id: Int, $sortDirection: ModelSortDirection, $filter: ModelDemographic_dataFilterInput, $limit: Int, $nextToken: String) {\n listDemographic_data(\n demographic_data_id: $demographic_data_id\n sortDirection: $sortDirection\n filter: $filter\n limit: $limit\n nextToken: $nextToken\n ) {\n items {\n demographic_data_id\n user_id\n country\n state\n tribe\n height\n weight\n sex\n ethnic_group\n physical_activity_level\n smoking_history\n occupational_exposure\n previous_disease\n respiratory_medication_use\n pregnant\n }\n nextToken\n __typename\n }\n}\n","variables":{}} When I tried to run this query through AppSync it told me Once I removed that I was able to run the query. Wondering if this is what the issue is. |
@chrisbonifacio Could this be from postgres not having a sortkey field? |
@blipps199 I'm not sure but this sounds like a potential duplicate of this other issue I was able to reproduce: |
In the meantime, until we fix this bug, you should be able to use If you want to generate graphql statements, you can use the following CLI command: https://docs.amplify.aws/react/reference/cli-commands/#npx-ampx-generate-graphql-client-code |
Thanks @chrisbonifacio. I was able to take my generated queries file, dupe it so I can make edits, removed |
@blipps199 Fix for #2946 has been published. The next time you make a deployment, you should receive the fix automatically. Could you check if this addresses your issue? |
Amplify CLI Version
N/A
Question
Keep in mind I replaced some sensitive info with placeholders.
Here is the schema(schema.ql.ts) auto generated using this
npx ampx generate schema-from-database --connection-uri-secret SQL_CONNECTION_STRING --out amplify/data/schema.sql.ts
.Here is my data/resource.ts
Here is my front end code:
I know this might be overkill but I want to provide as much as I can.
I think this might have been what you were looking for. I just posted the queries file. I used this command to generate it
npx ampx generate graphql-client-code --format graphql-codegen --statement-target typescript --out ./src/graphql/
. Not really sure how this file is then referenced...API.ts
The text was updated successfully, but these errors were encountered: