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

Gen 1 Updated Amplify CLI and getting errors on hosting push #2757

Open
2 tasks done
gakinson opened this issue Aug 6, 2024 · 5 comments
Open
2 tasks done

Gen 1 Updated Amplify CLI and getting errors on hosting push #2757

gakinson opened this issue Aug 6, 2024 · 5 comments
Assignees
Labels
DataStore question Further information is requested transferred

Comments

@gakinson
Copy link

gakinson commented Aug 6, 2024

How did you install the Amplify CLI?

npm

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

18

Amplify CLI Version

12.12.5

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.

nope

Describe the bug

We upgraded to use the latest CLI version from 10.8.X to 12.12.5 and the push works fine locally, but when we update it on the hosting cli build, we get the following error

2024-08-06T19:00:32.095Z [WARNING]: ✖ There was an error initializing your environment.
2024-08-06T19:00:32.103Z [INFO]: 🛑 DataStore does not support 1 to 1 connection with both sides of connection as optional field: User.conversation
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

My guess is that it has something to do with the Datastore thing, but we do not use datastore and would opt to disable/remove it from our amplify project, but we do not know how to.

One work around was to reproduce the amplifyPush.sh script and remove the codegen related tasks and then run an amplify push -y as a build step. Is there any issues in doing it this way? Or is there any way to disable Datastore.

Expected behavior

amplify deployment succeeds

Reproduction steps

Not really much to share here

Project Identifier

Log output

2024-08-06T19:00:28.304Z [WARNING]: Be careful when using @auth directives on a field in a root type. @auth directives on field definitions use the source object to perform authorization logic and the source will be an empty object for fields on root types. Static group authorization should perform as expected.

277

2024-08-06T19:00:31.094Z [WARNING]: Be careful when using @auth directives on a field in a root type. @auth directives on field definitions use the source object to perform authorization logic and the source will be an empty object for fields on root types. Static group authorization should perform as expected.

278

2024-08-06T19:00:32.095Z [WARNING]: ✖ There was an error initializing your environment.

279

2024-08-06T19:00:32.103Z [INFO]: 🛑 DataStore does not support 1 to 1 connection with both sides of connection as optional field: User.conversation

280

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

281

2024-08-06T19:00:32.175Z [INFO]:

282

2024-08-06T19:00:32.176Z [INFO]: Session Identifier: 4716c47b-7212-482f-a684-678d3f19f461

283

2024-08-06T19:00:32.271Z [ERROR]: !!! Build failed

284

2024-08-06T19:00:32.271Z [ERROR]: !!! Error: Command failed with exit code 1

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 Aug 9, 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 Aug 9, 2024
@chrisbonifacio
Copy link
Member

Hi @gakinson , that is indeed a strange error to see if DataStore is not enabled.

Can you check your amplify/backend/api/<apiName>/cli-inputs.json file and let me know if there is a property like this?

"conflictResolution": {
  "defaultResolutionStrategy": {
    "type": "AUTOMERGE"
  }
},

If not, then I'm not sure why the hosting build would have it enabled. You then might want to check what version of the Amplify CLI the hosting build is using and make sure it matches the version you've upgraded to locally.

@chrisbonifacio chrisbonifacio added pending-response question Further information is requested and removed pending-triage labels Aug 9, 2024
@gakinson
Copy link
Author

gakinson commented Aug 9, 2024

Hello @chrisbonifacio,

This is our cli-inputs.json
Screenshot 2024-08-09 at 12 34 21 PM

What I noticed in the amplify docs is that it is initialized when the aws-amplify/datastore dependency is added to the project, which is there by default when you use the aws-amplify library which is required.
Screenshot 2024-08-09 at 12 35 24 PM

Screenshot 2024-08-09 at 12 36 05 PM

@chrisbonifacio
Copy link
Member

chrisbonifacio commented Aug 10, 2024

Thank you for sharing @gakinson . An empty config means that DataStore is not enabled on your API. Were you able to check the Amplify CLI version that your hosting build is using?

Also, you mentioned removing "codegen related tasks" from the amplifyPush.sh script. Can you share what tasks exactly they were performing? Was there an amplify codegen models command being run?

@gakinson
Copy link
Author

@chrisbonifacio This did not end up resolving the issue for me in the end. I still get the Datastore error on each build that has an API change. To make the deployment green, I just run it twice for now and the second build will succeed because it detects there are no changes to api and then it will not run the codegen commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DataStore question Further information is requested transferred
Projects
None yet
Development

No branches or pull requests

4 participants