Open juri-diener opened 1 year ago
Hi @juri-diener, Thank you for bringing up this issue. It appears that you are utilizing an outdated version of the Amplify CLI (10.6.2). Would you please consider updating to the most recent version and then attempting the mock functionality again?
Hi @juri-diener, Thank you for bringing up this issue. It appears that you are utilizing an outdated version of the Amplify CLI (10.6.2). Would you please consider updating to the most recent version and then attempting the mock functionality again?
The problem is, I had the latest version but it was even worse. I could not do anything in the explorer. Was only a white field. It looked something like this. And where the text is, this was as well just a blank white field.
I does not recognize my schema with the latest version.
Only when I did a downgrade it worked. So that I could run some queries, mutations. The Problem now is that I get the Unauthorized error.
What is now the better way to fix this issue or update and then fix the issue that my schema is not recognized.
So I tried with a new project and chose as api Cognito user pool instead of api. And it's working now. But there is one issue I don't understand. If I change from private to public on this code: @auth(rules: [{ allow: private, operations: [read] }, { allow: owner }]) {
I get this error: InvalidDirectiveError: @auth directive with 'apiKey' provider found, but the project has no API Key authentication provider configured.
Hi @juri-diener, did you add both API_KEY
and Cognito user pools Auth providers to your API? You can do so via amplify update api
and following:
? Select a setting to edit Authorization modes
? Choose the default authorization type for the API API key
✔ Enter a description for the API key: ·
✔ After how many days from now the API key should expire (1-365): · 7
? Configure additional auth types? Yes
? Choose the additional authorization types you want to configure for the API Amazon Cognito User Pool.
I am however able to reproduce the UnAuthorized error if using only API_KEY from the mock console. Marking it as a bug.
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication, GraphQL API
Amplify Categories
auth, api
Environment information
Describe the bug
Get Unauthorized as response.
Expected behavior
Should just work!!!
Reproduction steps
amplify mock api open the url run mutation
Code Snippet
Log output
aws-exports.js
const awsmobile = { "aws_project_region": "us-east-1", "aws_appsync_graphqlEndpoint": "http://192.168.0.172:20002/graphql", "aws_appsync_region": "us-east-1", "aws_appsync_authenticationType": "API_KEY", "aws_appsync_apiKey": "da2-fakeApiId123456", "aws_appsync_dangerously_connect_to_http_endpoint_for_testing": true, "aws_cognito_identity_pool_id": "us-east-1:961e69fb-f2d3-4e38-9ba4-...", "aws_cognito_region": "us-east-1", "aws_user_poolsid": "us-east-1.....", "aws_user_pools_web_client_id": "....", "oauth": {}, "aws_cognito_username_attributes": [ "EMAIL" ], "aws_cognito_social_providers": [], "aws_cognito_signup_attributes": [ "NAME" ], "aws_cognito_mfa_configuration": "OFF", "aws_cognito_mfa_types": [ "SMS" ], "aws_cognito_password_protection_settings": { "passwordPolicyMinLength": 8, "passwordPolicyCharacters": [ "REQUIRES_LOWERCASE", "REQUIRES_NUMBERS", "REQUIRES_SYMBOLS", "REQUIRES_UPPERCASE" ] }, "aws_cognito_verification_mechanisms": [ "EMAIL" ] };
export default awsmobile;
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
type User @model @auth(rules: [{ allow: public }]) { id: ID! email: String bio: String profileImg: String isChurch: Boolean nofPosts: Int nofFollowers: Int nofFollowings: Int }