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

Still having issues with schema, and autocomplete #3047

Open
akilisosa opened this issue Nov 24, 2024 · 6 comments
Open

Still having issues with schema, and autocomplete #3047

akilisosa opened this issue Nov 24, 2024 · 6 comments
Assignees
Labels
bug Something isn't working data-schema Gen 2 pending-maintainer-response Issue is pending a response from the Amplify team.

Comments

@akilisosa
Copy link

Amplify CLI Version

12.13.0

Question

I am using amplify gen2 in my angular project. I asked this question in the thursday chats, and it seemed like it resolved last time in my react app, however I cannot figure out the solution to this in my current project.

there are issues related to this, but basically what i heard in the meeting was that if its my amplify_outputs.json it should be available:

{497A385F-1F56-4FF5-B766-33E6EC99A19D}

Room type:
{1B041AA5-41FF-4441-B282-0FA6CBC0D011}

{E4F4927C-651A-4CFA-ADF3-613952955208}

as you can see the regular .list works. but the index ones based of the schema throw an error.

@akilisosa akilisosa added pending-triage question Further information is requested labels Nov 24, 2024
@chrisbonifacio chrisbonifacio self-assigned this Nov 25, 2024
@chrisbonifacio
Copy link
Member

Hi @akilisosa 👋 thanks for raising this issue.

What particular error are you getting when trying to run the listRoomsBySimpleCode query?

@chrisbonifacio chrisbonifacio added pending-community-response Issue is pending a response from the author or community. and removed pending-triage labels Nov 25, 2024
@akilisosa
Copy link
Author

{EA8C1437-37BF-4763-85ED-13330E3E8731}

Property 'listRoomsBySimpleCode' comes from an index signature, so it must be accessed with ['listRoomsBySimpleCode'].

If i change all that, and add 'any' as the client type, i get a client error when i make the request:
{F7827264-6024-4F57-83E6-C1D8AE71AECB}

If you are interested in testing out the repo - this is the project i was working for the hackathon: https://github.com/akilisosa/nom-kitties-angular-v5 s

I was doing it to get familiar with gen2 before i transfer my other app over.

@github-actions github-actions bot added pending-maintainer-response Issue is pending a response from the Amplify team. and removed pending-community-response Issue is pending a response from the author or community. labels Nov 25, 2024
@chrisbonifacio
Copy link
Member

Hi @akilisosa thank you for the repro app. i wasn't able to see that error, i ran into some issues trying to install the dependencies:

 code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: amplify-angular-template@0.0.0
npm error Found: @angular/compiler-cli@18.2.13
npm error node_modules/@angular/compiler-cli
npm error   dev @angular/compiler-cli@"~18.2.13" from the root project
npm error
npm error Could not resolve dependency:
npm error peer @angular/compiler-cli@"^16.0.0" from @angular-devkit/build-angular@16.2.16
npm error node_modules/@angular-devkit/build-angular
npm error   dev @angular-devkit/build-angular@"~16.2.12" from the root project

not sure how to resolve these angular deps errors

@chrisbonifacio chrisbonifacio added pending-community-response Issue is pending a response from the author or community. and removed pending-maintainer-response Issue is pending a response from the Amplify team. labels Dec 3, 2024
@akilisosa
Copy link
Author

akilisosa commented Dec 3, 2024

@chrisbonifacio those install issues might be because you have an older version of angular cli installed on your computer/cached somewhere.

The updated version of nomkitties-v5 is using angular version 19 of angular which was just released a week ago, you can also just do --force to install them. and it should run.

if you run into the dependency issue with appsync library:

R! Could not resolve dependency:
npm ERR! peer @angular/core@"^17.0.0 || ^18.0.0" from apollo-angular@7.2.1
npm ERR! node_modules/apollo-angular
npm ERR!   apollo-angular@"^7.2.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@18.2.13
npm ERR! node_modules/@angular/core
npm ERR!   peer @angular/core@"^17.0.0 || ^18.0.0" from apollo-angular@7.2.1
npm ERR!   node_modules/apollo-angular
npm ERR!     apollo-angular@"^7.2.1" from the root project

just force that one through there are no issues.

@github-actions github-actions bot added pending-maintainer-response Issue is pending a response from the Amplify team. and removed pending-community-response Issue is pending a response from the author or community. labels Dec 3, 2024
@chrisbonifacio
Copy link
Member

chrisbonifacio commented Dec 4, 2024

@akilisosa thank you! i was able to install and run the dev server.

i was also able to reproduce the issue:

CleanShot 2024-12-04 at 11 59 13@2x

a workaround seems to be accessing the object like this:

res = (
        await client.models.Room['listRoomsBySimpleCode']({ simpleCode: code })
      ).data;

i'll mark this as a bug for the team to investigate further.

@chrisbonifacio chrisbonifacio added bug Something isn't working pending-community-response Issue is pending a response from the author or community. and removed pending-maintainer-response Issue is pending a response from the Amplify team. question Further information is requested labels Dec 4, 2024
@akilisosa
Copy link
Author

@chrisbonifacio I'm glad you were able to get through it.

While i could get past the linting error with the ['name'] syntax, when I tried to make the actual all I got an error.

@github-actions github-actions bot added pending-maintainer-response Issue is pending a response from the Amplify team. and removed pending-community-response Issue is pending a response from the author or community. labels Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working data-schema Gen 2 pending-maintainer-response Issue is pending a response from the Amplify team.
Projects
None yet
Development

No branches or pull requests

3 participants