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

How can we sync dynamodb with datastore in nodejs? #31

Open
Ahmedijaz19 opened this issue Oct 27, 2021 · 0 comments
Open

How can we sync dynamodb with datastore in nodejs? #31

Ahmedijaz19 opened this issue Oct 27, 2021 · 0 comments

Comments

@Ahmedijaz19
Copy link

I am using Amplify CLI for datastore. It is working fine. But it is not syncing data with dynamodb. Means Post gets save in datastore local storage but does not go in dynamodb POST table. My code is below

const {syncExpression} = require("aws-amplify")
const {Amplify} = require("aws-amplify")
const Post = require("./models")
const awsconfig = require("./aws-exports")
Amplify.configure(awsconfig.awsmobile)

exports.handler = async (event) => {
    try {
        console.log("inside")
        
        let response=await DataStore.save(
            new Post.Post({
              title: "My second Post",
              status:"DRAFT",
              rating: 7
            })
          );
    
          console.log("Post saved successfully!");
     
        return response;
      } catch (error) {
        console.log("Error saving post", error);
      }

};

This is not storing my data to dynamodb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant