amplify-studio icon indicating copy to clipboard operation
amplify-studio copied to clipboard

Data and Content: blank screen when model has custom key which is not ID

Open lilienblum opened this issue 4 years ago • 8 comments

Before opening, please confirm:

App Id

No response

Region

No response

Amplify Console feature

No response

Describe the bug

admin/{appid}/{env}/datastore cannot be opened (blank screen) when model has custom key which is not ID:

455.fd53f4c6.chunk.js:2 TypeError: Cannot read property 'value' of undefined
    at Ke (main.2ea88a27.chunk.js:1)
    at main.2ea88a27.chunk.js:1
    at Array.map (<anonymous>)
    at main.2ea88a27.chunk.js:1
    at Array.map (<anonymous>)
    at a.value (main.2ea88a27.chunk.js:1)
    at Uo (455.fd53f4c6.chunk.js:2)
    at qo (455.fd53f4c6.chunk.js:2)
    at hs (455.fd53f4c6.chunk.js:2)
    at cu (455.fd53f4c6.chunk.js:2)

Expected behavior

admin/{appid}/{env}/datastore can be opened

Reproduction steps

https://user-images.githubusercontent.com/7160998/130135378-f64328d2-cb88-4b31-9bbf-e3ddb7e47b0e.mov

https://user-images.githubusercontent.com/7160998/130135387-b43bd1ec-6401-4860-a70e-d21d557a2128.mov

Build Settings

No response

Additional information

No response

lilienblum avatar Aug 19 '21 19:08 lilienblum

I am also getting this exact same behaviour when I have a custom id i.e. that is not named 'id'

conorw avatar Sep 01 '21 13:09 conorw

@cslogan-red I don't think it's a feature request, it's definitely a bug

lilienblum avatar Sep 01 '21 14:09 lilienblum

All GQL models within Admin UI are required to have an id field as primary key, we don't support the concept of non-id custom keys due to underlying limitations of DataStore itself, it's in our backlog to add support for this feature in the future.

cslogan-red avatar Sep 01 '21 16:09 cslogan-red

This should be mentioned in the docs. One of the examples uses email as a private key: https://docs.amplify.aws/cli/graphql-transformer/key/#example-get-customers-by-email

lilienblum avatar Sep 05 '21 20:09 lilienblum

So all my models are id based with the exception of using @key which I believe just makes another table where the desired field(s) become the id which is likely the same thing just mentioning as my experience with this issue

24jr avatar Sep 05 '21 23:09 24jr

This should be mentioned in the docs. One of the examples uses email as a private key: https://docs.amplify.aws/cli/graphql-transformer/key/#example-get-customers-by-email

Well this is just for the ui version. You can still use email as primary key and work fine in your website and all that just not in the admin ui clickable interface

24jr avatar Sep 05 '21 23:09 24jr

@24jr from what I understood, Datastore won’t work

lilienblum avatar Sep 05 '21 23:09 lilienblum

@dn-l Oh maybe. I don't use that. But I think straight up gql calls work fine

24jr avatar Sep 05 '21 23:09 24jr