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

GraphQL interfaces breaking builds/deploys since 11 #2956

Open
2 tasks done
whunter opened this issue Oct 14, 2024 · 6 comments
Open
2 tasks done

GraphQL interfaces breaking builds/deploys since 11 #2956

whunter opened this issue Oct 14, 2024 · 6 comments
Labels
bug Something isn't working pending-community-response Issue is pending a response from the author or community. transferred

Comments

@whunter
Copy link

whunter commented Oct 14, 2024

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

20.17.0

Amplify CLI Version

12.13.0

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.

updated nodejs runtime in lambda

Describe the bug

Beginning in Amplify 10 (I think) we started seeing this warning on builds because we're using an interface in our schema.graphql. They would not cause builds to fail though. We've had our builds pinned to 10.8.1 which does still support interfaces.

2024-10-14T18:57:36.877Z [WARNING]: ✖ There was an error initializing your environment.
2024-10-14T18:57:36.883Z [INFO]: 🛑 Unknown type GenericRecordType for field items. Did you forget to add the @model directive

Beginning in Amplify 11, this began causing builds to fail.

And we can no longer pin to 10.8.1, because it seemingly tries to build node14 lambdas regardless of what we put in our cloudformation templates. So those break now as well and we can't build our app at all.

Expected behavior

Amplify build/deploy shouldn't require that all GraphQL return types have @model. That isn't always the case. (interfaces | unions)

Reproduction steps

  1. Deploy an Amplify app with an interface in the schema.graphql
  2. Receive warning/error message

Project Identifier

Amplify app id: d2ysrrdhih4bgc

Log output

# Put your logs below this line

2024-10-14T18:57:36.877Z [WARNING]: ✖ There was an error initializing your environment.
2024-10-14T18:57:36.883Z [INFO]: 🛑 Unknown type GenericRecordType for field items. Did you forget to add the @model directive

Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@ykethan
Copy link
Member

ykethan commented Oct 15, 2024

Hey,👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂

@ykethan ykethan transferred this issue from aws-amplify/amplify-cli Oct 15, 2024
@AnilMaktala
Copy link
Member

Hi @whunter  👋 , thanks for raising this issue.we are working on reproducing the issue. Could you please run below command and send us the project identifier. amplify diagnose --send-report.
please refer here

@AnilMaktala AnilMaktala added pending-community-response Issue is pending a response from the author or community. question Further information is requested labels Oct 15, 2024
@whunter
Copy link
Author

whunter commented Oct 15, 2024

Hi @AnilMaktala,
Broken app:
Project Identifier: 22892ffad33ef7cc8282e9383c97ace5

If it helps, the app below built, deployed, and is currently running using the same schema (more or less). We still have it pinned to 10.8.1 in build settings and I assume it hasn't been deployed since before the nodejs14.x lambda runtime reached end of support. If we tried to update it now, it would break either because of that nodejs runtime error if we tried Amplify <=10 OR it would break because of the interface in the schema in Amplify > 10.

Project Identifier: f70ad9709259f0ce4eade22db19e620b

Thanks for your attention to this. We've been using an interface for years in Amplify with no problems. I probably wouldn't even be reporting this now if we could still just build/deploy w/ 10.8.1, although that isn't ideal.

@whunter
Copy link
Author

whunter commented Oct 15, 2024

@AnilMaktala
fwiw, I have no idea what I'm talking about. but it looks to me like amplify push and build both are running codegen as part of their processes. They both throw the same warning/error message when a schema uses an interface. In push it raises a warning but still continues. In build it throws an actual error that fails the build. To me that looks like the only difference.

@AnilMaktala
Copy link
Member

AnilMaktala commented Oct 16, 2024

Hey @whunter, Thanks for sharing the project identifier. We can reproduce this issue in both latest and 10.8.1 versions. are you sure no other changes was done in the schema?

image

As workaround, Can try creating two search queries for models (collection and Archieve) implementing the interface instead one search query using the common interface?

@AnilMaktala
Copy link
Member

After further investigation, I found that despite the amplify codegen models failing locally, the Amplify push was successfully deployed in version 10.8.1.

@AnilMaktala AnilMaktala added bug Something isn't working and removed question Further information is requested pending-triage labels Oct 18, 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 pending-community-response Issue is pending a response from the author or community. transferred
Projects
None yet
Development

No branches or pull requests

3 participants