Closed perryneal11 closed 2 years ago
Hi,
If you want to clear the data which has been there locally you can clear your IndexedDB by running Datastore.clear
and also make sure they are not present in DynamoDB. We are still looking into API Key issue which is more related to CLI than JS.
I am on day 7 of simply trying to read or write data to amplify. Is there a way to completely remove amplify from my project and re add it to hopefully fix this? Ignoring the strangeness of the api key changing itself, how do I just get into s working state of reading and writing data?
This was resolved by pushing createapi: 0 as instructed here https://docs.amplify.aws/cli-legacy/graphql-transformer/config-params/#:~:text=copy-,CreateAPIKey,-CreateAPIKey
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server amplify-help
forum.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
GraphQL API, DataStore
Amplify Categories
storage, api
Environment information
Describe the bug
I am attempting to re use an existing amplify backend with auth and graphAPI that has worked on a react native project, and bring it into a react project.
I have been running in circles googling, posting everywhere for help, running
amplify pull,
deletingnode modules
andaws-export.js
then re runningnpm -i
andamplify init
deleting and re cloning the repo, running amplify update api, and I am out of things to try, and places to ask.I receive the following errors in the console.
DataStore - subscriptionError Connection failed: com.amazonaws.deepdish.graphql.auth#UnauthorizedException
DataStore - User is unauthorized to query syncUsers with auth mode API_KEY. No data could be returned.
Here is the problematic code where I am attempting to create a User in the data base if one is not found (There won't be, I have deleted everything everywhere as much as I could even going into dynamo db erasing everything trying to start over.). Please note here there are auth users, and users in the database where I have created a model of a user. The auth portion seems to work fine. I can log in and get the user. Anything with Datastore does not seem to work.
Whenever I run
amplify pull,
my api key get overwritten to some old no longer existent api key. If I manually copy and paste my api key from what is shown in the amplify console UI, I can actually get rid of these errors!. However, when I do so, the issue transforms, and while I can get data back through queries, and create data through add and update, the data is old data that i deleted a long time ago, and I have no idea where this is held or how it exists.****. Additionally, these changes in data are not reflected in amplify anywhere. I know this is a feature, I think, where amplify looks for data locally before going to the cloud. In this specific case, it is not useful and confusing.I am very confused on what I am doing wrong, and while I don't expect this to be a bug exactly, I am out of places to ask. I have made posts on stack overflow, reddit, the discord channel, and am considering hiring a freelancer to hep me figure this out.
Expected behavior
Datastore.query should allow me to query and write data to the database where I can view the changed data in the amplify console UI and not have local data separate of what's in the cloud, and amplify pull should not replace my api key with some api key that doe not exist.
Reproduction steps
Code Snippet
Log output
aws-exports.js
/ eslint-disable / // WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
const awsmobile = { "aws_project_region": "us-east-1", "aws_cognito_identity_pool_id": "us-east-1:e57ed0ce-f903-40c0-9c0b-2c03697d8b26", "aws_cognito_region": "us-east-1", "aws_user_pools_id": "us-east-1_Sk5xe58Ic", "aws_user_pools_web_client_id": "7abv1gbaai78gv0n63ovu8p0jo", "oauth": {}, "aws_cognito_username_attributes": [ "EMAIL" ], "aws_cognito_social_providers": [], "aws_cognito_signup_attributes": [ "EMAIL" ], "aws_cognito_mfa_configuration": "OFF", "aws_cognito_mfa_types": [ "SMS" ], "aws_cognito_password_protection_settings": { "passwordPolicyMinLength": 8, "passwordPolicyCharacters": [] }, "aws_cognito_verification_mechanisms": [ "EMAIL" ], "aws_appsync_graphqlEndpoint": "https://auic44h4w5cbpda55xqsiysjcu.appsync-api.us-east-1.amazonaws.com/graphql", "aws_appsync_region": "us-east-1", "aws_appsync_authenticationType": "API_KEY", "aws_appsync_apiKey": "da2-4okjaeglize3lf6e36jl5csnby" };
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
No response