Open neaumusic opened 2 years ago
Hey @neaumusic, thank you for reaching out. On creating a GraphQL API with the provided reproduction steps. I was unable to observe an error when adding properties such as updatedAt
.
could you let know if there are any additional step utilized in the reproduction?
@ykethan in that screenshot, there should be images correlated with the content, the SK and LSI2 are backwards on your image model
the image should say "PK": "_CONTENT", "SK: "asdf", "LSI2": "1234"
then just run listContents
to fetch items/*
and items/images/items/*
the error will occur in fetching items/images/items/*
since the rest of the image attributes are not projected onto the LSI and the query doesn't fetch from the base dynamodb table
@ykethan I don't know if you ever got back around to this one, but it should still be an issue
Before opening, please confirm:
How did you install the Amplify CLI?
yarn
If applicable, what version of Node.js are you using?
14.20.1
Amplify CLI Version
10.2.3
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No, all new stack and CLI only
Amplify Categories
api
Amplify Commands
Not applicable
Describe the bug
Specifying a
@hasMany
relationship targeting an LSI index withKEYS_ONLY
allows queries inamplify mock
that fetch from the related table base (not just keys in the LSI index). Running the same queries via AWS Console AppSync does not, returns null for additional fields, throwing errors if those fields are declared as non-nullable.From the dynamodb docs:
See the bottom row in this table
Expected behavior
I would expect the AWS Console Appsync Queries to fetch non-projected attributes from the base table, at a slightly higher latency and read cost.
Reproduction steps
amplify init
amplify add auth
(Cognito)amplify add api
blank schemaschema.graphql
cli.json
to set"secondarykeyasgsi": false,
KEYS_ONLY
code intooverride.ts
amplify mock
createContent
withSK: "1234"
, run mutationcreateImage
withSK: "asdf"
andLSI2: "1234"
listContent
, specify allitems
of the content, allitems
of the imagesPK: "_CONTENT"
for both) and query stepsupdatedAt
) that are non-nullableGraphQL schema(s)
Note Content and Image share
PK: _CONTENT
, and that Content@hasMany
targets ImageLSI2
Project Identifier
529fd62f57a7db0816abf0c159f3a791
Log output
No response
Additional information
No response