by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Kros21
    @Kros21
    API key is...
    Thanks , but I am not clear in every fields now.
    Sorry @dantasfiles
    Daniel S. Dantas
    @dantasfiles
    @Kros21 ?
    Takeshi
    @iwatakeshi

    @claym I've figured out the credentials. Thanks.

    By chance, would you know what the apixxxGraphQLAPIEndpointOutputenv variable to should be when mocking the lambda function? I was having this issue: aws-amplify/amplify-cli#2453 and the last answer given seems to resolve the issue. However, I've tried adding http://[ip address]:20002as the endpoint and it doesn't like the response. It gives me an unexpected token < error...which probably means the endpoint is not correct.

    Armin Broubakarian
    @arminbro
    Is it possible to use Amplify-CLI just for the backend and separate from the frontend codebase?
    Jeff Finley
    @quickliketurtle
    Yep
    Armin Broubakarian
    @arminbro
    Hey Jeff, thanks for the quick reply dude. Can you point me where in the docs I can read more on that?
    Jeff Finley
    @quickliketurtle
    Not sure there is a specific place… So lets say you wanted to create just a cognito pool, you would run amplify init then amplify add auth select your options, then amplify push. Now you have the deployed stack with Auth setup. To keep this backend only, you would just not setup any of the frontend js libs, etc…
    If you wanted to use that resource in another repo / app, you can use the amplify js lib, and configure it ‘manually’ by passing in the values for the pool you created in the backend repo.
    Armin Broubakarian
    @arminbro
    Yeah that makes sense. Here's what I'm confused about. When you run amplify init it asks you to choose a frontend framework like React, Angular or none (aka vanilla JavaScript). I guess what I was asking is if there is a flag to bypass that part of the init.
    Like an official way of telling amplify that this is not running in a frontend project.
    Jeff Finley
    @quickliketurtle
    Ah, that just sets some variables in amplify/.config/project-config.json that are used with the amplify publish command...
    Armin Broubakarian
    @arminbro
    Cool. Thanks for the help.
    Kros21
    @Kros21
    @dantasfiles
    how are you today?
    Craig Janik
    @got879
    OK
    I already have an AWS account - I don't see a login page on the Amplify Framework page
    Frank Phillips
    @frank-amplify_gitlab
    Hi, Does anyone have inside information about the Amplify Week in San Fransisco from 16th March? The event is list here https://amplify.aws/community/events/2020/03/16/amplify-week-sf but there is no information on the expected page!
    bbop
    @bishonbopanna
    @dantasfiles - Thanks Daniel. I tried out your recommendation, also mentioned in the "hasMany" section in https://aws-amplify.github.io/docs/cli-toolchain/graphql?sdk=js and the referenced data was NOT loading due to the query having nextToken. Let me elaborate, in the attached screen shot, the query gets generated as : comments {
    nextToken
    } which I had to change to below to get the data. Why does this - "nextToken" happen ? what am i missing ?
    comments {
    items{
    content
    }
    }
    image.png
    Jeff Finley
    @quickliketurtle
    nextToken is used as there is a limit on the number of records that can be scanned with each API request (this is specific to DynamoDB though). So when you make a request, you get back results and a nextToken, you then use the nextToken in your next request to tell the query where you left off. So you would recursively call this until there was no more nextToken.
    When Amplify generates your queries for you, it defaults to just asking for nextToken for relationship. (not sure why though). So your options are what you did, which is update the query. Or what I would do is write a custom query. That way your changes are not overwritten on your next push.
    @bishonbopanna :point_up:
    Jeff Finley
    @quickliketurtle
    @frank-amplify_gitlab I just shot an email to the SF Loft asking for them to add info to their page and included a link to the Amplify Event page… Hopefully will get more info soon.
    bbop
    @bishonbopanna
    @quickliketurtle - Thanks Jeff. Makes sense. +1 to custom query. However it was interesting that in my case the next token was coming back as null - not entirely sure what I did to goof up. For now I made progress with custom query.
    Roni Yosofov
    @RoniFinTech

    Hi,
    I run a GraphQL mutation using the AWS AppSync Queries page. Now, the first time I try this mutation, everything works fine and the first time, but if I try to submit the mutation again without changing anything, I get an error...

    This is my mutation:

    mutation {
    createStore(
    input: {
    storeName: "SomeStoreNYC",
    geoLocation: {
    latitude: 0.73,
    longitude: 0.45
    },
    address: {
    city: "New York",
    country: "USA",
    state: "NY",
    address: "555 W 55th Street",
    zipcode: "10010"
    },
    logoUrl: {
    key: "logo-key",
    bucket: "logo-bucket",
    region: "usa-1"
    },
    phoneNumber: "999-999-3333"
    }
    ){
    id
    }
    }

    This is the error that I get if I try the mutation above two times:

    {
    "data": {
    "createStore": null
    },
    "errors": [
    {
    "path": [
    "createStore"
    ],
    "data": {
    "id": "2c03a100-f992-4f20-a6db-799d98dc3d6c"
    },
    "errorType": "DynamoDB:ConditionalCheckFailedException",
    "errorInfo": null,
    "locations": [
    {
    "line": 2,
    "column": 5,
    "sourceName": null
    }
    ],
    "message": "The conditional request failed (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ConditionalCheckFailedException; Request ID: A4NNQQ0SR2U23FSHO0EK7AM5BJVV4KQNSO5AEMVJF66Q9ASUAAJG)"
    }
    ]
    }

    Any suggestions??
    Thanks

    Frank Phillips
    @frank-amplify_gitlab
    @quickliketurtle Thanks
    eliasericsson
    @eliasericsson
    Can anyone explain how the ModelTodoFilterInput in a GraphQL query is supposed to be constructed?
    eliasericsson
    @eliasericsson
    Maybe there is some other way, what I'm trying to do is to retrieve a record where the field guid matches a specific value. I just want one record.
    Steve Daly
    @spdaly
    Hello all...extending an application with a GraphQL API. It's based on an existing DynamoDB table, so I setup a separate AppSync API and exported the schema in imported it into the amplify add api CLI as an annotated schema. Everything setup in the backend. But, it doesn't look like auth is correct. The run schema is disabled after I login.
    Daniel S. Dantas
    @dantasfiles
    @eliasericsson modeltodofilterinput in listTodos is a filter that runs after dynamodb returns the data requested, see Query and Scan. if you just want one record, do getTodo graphql which does a dynamodb getitem
    @RoniFinTech what's your schema?
    Daniel S. Dantas
    @dantasfiles
    type Todo @model {
      id: ID!
      name: String!
      description: String
    }

    and

    type Todo @model @key(fields:["id"]){
      id: ID!
      name: String!
      description: String
    }

    generate distinct listTodo, createTodo and deleteTodo operations. That doesn't make any sense to me, they should be the same, right?

    Jeff Finley
    @quickliketurtle
    @RoniFinTech seeing the related schema would help. But I’d look at the data you are writing with each request and make sure the unique ids are different. With dynamo that is the partition and sort key. The condition expression could be failing it a record with the same key already exists.
    @dantasfiles when you use the @key directive a GSI is created on the dynamo table. So new operations are created that target the GSI rather than the table itself.
    Radu
    @raduoprea
    @aftabahmed1286 Hey AfyGit! Did you find a solution for the "API category is not configured" error?
    Daniel S. Dantas
    @dantasfiles
    @quickliketurtle Amplify creates a gsi if it's a named key. if the @key directive doesn't have a name, then it specifies the primary key of the underlying table.
    In both those examples, the primary key is just id, and the underlying dynamodb table Todo is the same, but the graphql schema and resolvers that are generated by Amplify are different, which drives my spider-sense crazy
    Jeff Finley
    @quickliketurtle
    @dantasfiles Sorry I didn’t catch that in your question… So just to cleafiy if you generate queried is the first scheme, then seperatly generate queries with the second schema, you’d expect them to be exactly the same right? But your seeing differences?
    Jeff Finley
    @quickliketurtle
    @dantasfiles Glad you found the reason for the differences.
    Do you have an Idea of what would be less clumsy?
    Daniel S. Dantas
    @dantasfiles
    @quickliketurtle nope, it's a hard problem, and anyone who cares enough to mess with the keys of their underlying dynamodb tables can certainly modify their resolvers to do whatever they want
    eliasericsson
    @eliasericsson
    @dantasfiles Thanks, what I gather from the queries.js is that I have to provide an ID of the record I want. Here I'm looking for something like select ID where GUID like '<my-provided-guid>'
    @dantasfiles I guess what I'm after is to replace the ID that was generated for the records with one that I set, namely my GUID.
    Daniel S. Dantas
    @dantasfiles
    @eliasericsson when you create a Todo, you can specify an id, or, if you omit an id, the createTodo resolver that amplify generates will put a uuid into the id field of the created Todo, so I'm not sure what you mean by "replace the ID that was generated for the records with one that I set"
    eliasericsson
    @eliasericsson

    @dantasfiles Ok, here are the fields:
    id: ID!
    status: String!
    guid: String!
    region: String!
    upload_bucket: String
    upload_key: String

    Instead if using the ID as the key, I think I wan't to use my own guid. The ID can be dropped as it isn't used

    All in all, this is my schema:
    type Upload
      @model
      @auth(
        rules: [
          {
            allow: owner
            queries: [get, list]
            mutations: [create, update, delete]
          }
          {
            allow: groups
            groups: ["Director"]
            queries: null
            mutations: [create, update, delete]
          }
          {
            allow: groups
            groups: ["Audience"]
            queries: [get, list]
            mutations: null
          }
        ]
      )
      @key(
        fields: [
          "guid"
        ]
      )
      {
      id: ID!
      status: String!
      guid: String!
      region: String!
      upload_bucket: String
      upload_key: String
    }
    Daniel S. Dantas
    @dantasfiles

    if you have

    type Todo @model {
      id: ID!
      status: String!
      region: String!
      upload_bucket: String
      upload_key: String
    }

    then the following creation graphql operation gets generated by amplify:

    input CreateTodoInput {
      id: ID
      status: String!
      region: String!
      upload_bucket: String
      upload_key: String
    }
    type Mutation {
      createTodo(input: CreateTodoInput!, condition: ModelTodoConditionInput): Todo
    }

    which is what you want, you can specify the id when you create the Todo, or if you leave it out, amplify will create one for you

    eliasericsson
    @eliasericsson
    I'm kicking myself a little :) If I can just put in my guid as the ID then I'll be fine :)
    Daniel S. Dantas
    @dantasfiles
    @eliasericsson 🎉
    eliasericsson
    @eliasericsson
    @dantasfiles Thanks!