-
Notifications
You must be signed in to change notification settings - Fork 822
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
Composite sort key #5820
Comments
It is also happening to me |
This is a bug whereby composite key values are not being populated in dynamodb, see issue #6634 |
further confirmation is that it seems the issue is only with creating new records, updating a record gets the composite key values set correctly |
@frankclaassen thanks for pointing this out. From what I understanding, you are saying that if I use the composite key as I described above AND then update the records using that key the composite key will work correctly? Do I have to do anything else to get the composite key to work correctly? Is it a particular kind of update I have to do to the records? |
@johnEthicalTechnology you can't update a record using a composite key (not that I'm aware of anyway) but what I mean is if you run the update mutation (updateLead in your schema) generated by Amplify or write one in the console, then the composite key gets populated with actual data |
@johnEthicalTechnology might want to recheck your data, I'm on amplify 4.44.0 and magically this is not happening anymore since my last push to my repo which triggered a build. update: bug only seems to have disappeared in my dev system but is still happening in my prod system for some unknown reason |
Further testing and investigation has found that the issue in fact came in when I updated the record in my trigger function, I did not specify values for the keys used in composite keys in the input passed to the update mutation. No error was thrown for some reason and my data ends up with ${ctx...} values. IMHO, it is incorrect (and a bug in my opinion) of the resolvers to update composite keys when none of the values used in composite keys have changed |
@frankclaassen I created a new composite key. I'm on Amplify 4.45. I created a new record through my app and no composite key. I updated the same record through my app with an update query and still no composite key. When I create the MappingData record there are values for the keys that I'm using in the composite key. Yet still it's not creating the composite key. I even, just as suggested in this issue, re-generated my VTL code. Then I ran the update mutation and it still didn't generate the expected composite key for the records. @nikhname is it possible to get a bit of help with this one?? This is severely affecting the production environment for a client's app. Am I doing something that I shouldn't? What should I expect from a composite key? This is a screen of the index after I've used the update mutation. As you can see there's no items associated. This is the relevant part of the schema for the composite key:
I'm not sure if this makes a difference but when a record for MappingData table is created I'm using the @crft/appsync-gateway package which is basically an implementation of suggested use of graphql from a lambda |
@johnEthicalTechnology are you still facing this issue on recent versions of the CLI? I just spent some time trying to reproduce the issue, but I believe it has been fixed. |
I'm not sure. I'm not working on that project anymore. When I ran into this issue I found a workaround to get the functionality the project required so it wasn't a big issue. Thanks for checking! I'm happy for you (or me) to close it. |
Which Category is your question related to?
Indexing data with keys
Amplify CLI Version
4.32.1
You can use
amplify -v
to check the amplify cli version on your systemWhat AWS Services are you utilizing?
Lambda, DynamoDB, AppSync, SSM, IAM
Provide additional details e.g. code snippets
I created this composite key:
But when I run a query against it no data is returned even though I'm expecting data to be return. I don't get an error just an empty array. I'm not entirely sure why this is happening.
In the docs I read that I'm meant to back fill data. When I created another field (
status#createdTime
) and filled the value in then tried the query it returned the expected record.Then I create a brand new record in the table which I expect will be automatically have the new composite key applied to it but when I perform the query as before it doesn't find the new record. Does this mean I'm meant to create a field in the schema like so
status#createdTime
?Here's the schema. As you can see i've got a bunch of keys and I've not had any problems with them:
This is the query
This is the use of the query in my function:
This is the query in the AppSync console:
The text was updated successfully, but these errors were encountered: