aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.82k stars 821 forks source link

Command failed with exit code 1: in a ios project #13064

Open ykethan opened 1 year ago

ykethan commented 1 year ago

How did you install the Amplify CLI?

No response

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

No response

Amplify CLI Version

12.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

Describe the bug

Amplify CLI throws the error message

🚫 xcodeProject: 
-- Caused by: notFound(path: "<path>")
Command failed with exit code 1: /Users/<user>/.amplify/lib/aws-amplify-amplify-frontend-ios/resources/amplify-xcode import-config --path=/Users/<user>/Documents/apps/iostest

The error appears to be due to Xcode not being used. set the terminal as Vscode on init a well.

Expected behavior

provide a better error message

Reproduction steps

  1. amplify init (with Vscode and ios as config)
  2. should see it on init finish or can run amplify pull

Project Identifier

No response

Log output

``` # Put your logs below this line ```

Additional information

No response

Before submitting, please confirm:

klsetzer commented 1 year ago

I am seeing the same behavior with both the npm-installed amplify cli (12.4.0 and 12.2.3) and the script-installed amplify cli from https://github.com/aws-amplify/amplify-cli/issues/13104#issuecomment-1675137697.

I am attempting to init a new xcode/ios project. Xcode 14.3.1 is installed.


$ amplify pull --appId <app id> --envName staging
Opening link: https://us-east-1.admin.amplifyapp.com/admin/<app id>/staging/verify/?loginVersion=1
⠏ Confirm login in the browser or manually paste in your CLI login key:
Successfully received Amplify Studio tokens.
Amplify AppID found: <app id>. Amplify App name is: Hush
Backend environment staging found in Amplify Console app: Hush
? Choose your default editor: Xcode (macOS only)
βœ” Choose the type of app that you're building Β· ios
? Do you plan on modifying this backend? Yes
βœ” Successfully pulled backend environment staging from the cloud.
βœ…

βœ… Successfully pulled backend environment staging from the cloud.
Run 'amplify pull' to sync future upstream changes.

Updating Xcode project:
🚫 xcodeProject:
-- Caused by: notFound(path: "/Users/<user>")
πŸ›‘ Command failed with exit code 1: /Users/<user>/.amplify/lib/aws-amplify-amplify-frontend-ios/resources/amplify-xcode import-config --path=/Users/<user>

Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: fd397e50-186d-4cd3-8af1-efe79881f986
βœ” An unexpected error has occurred, opt in to send an error report to AWS Amplify with non-sensitive project configuration files. Confirm  (y/N) Β· no
dnhyde commented 10 months ago

Same here any solution or any hint on what is the issue? It seems for me there is some issue related with Swift Package Manager. With codegen the models are generated but then I get the same error from this issue (see below).

amplify codegen models --model-schema /Users/<user>/path/to/schema.graphql
Successfully generated models. Generated models can be found in /Users/<user>/<project-root-folder>/amplify/generated/models
Updating Xcode project:
🚫 xcodeProject:
-- Caused by: The element XCLocalSwiftPackageReference is not supported.
πŸ›‘ Command failed with exit code 1: /Users/<user>/.amplify/lib/aws-amplify-amplify-frontend-ios/resources/amplify-xcode import-models --path=/Users/<user>/<project-root-folder>

Note: I also get the same error with amplify pull --appId <appId> --frontend so it is not related to amplify codegen models

Proposed resolution does not help since I am in a frontend project following multi-frontend approach so there is no backend folder and amplify diagnose fails.

Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

amplify diagnose --send-report

Learn more at https://docs.amplify.aws/cli/reference/diagnose/
β ‹ Creating Zip
File at path: '<project-root-folder>/amplify/backend/backend-config.json' does not exist
βœ– Creating Zip