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

Fresh amplify pull fails with 🚫 folderNotFound

Open sebsto opened this issue 2 years ago • 10 comments
trafficstars

How did you install the Amplify CLI?

curl -sL https://aws-amplify.github.io/amplify-cli/install | bash && $SHELL

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

v20.6.0

Amplify CLI Version

12.4.0

What operating system are you using?

macOS 12.5.1 (21G83)

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

no

Describe the bug

This is a regression, it uses to work with previous version of the CLI When doing amplify pull on a fresh machine and repo, it fails with

🚫 folderNotFound: Amplify generated models not found at /Users/ec2-user/amplify-ios-getting-started/code/amplify/generated/models

amplify codegen models is the next step in the CI script. It is expected the generated directory does not exist at the moment of the pull

Pulling amplify environment
Amplify AppID found: d1lld0ga9eqxz2. Amplify App name is: iOSGettingStarted
Backend environment dev found in Amplify Console app: iOSGettingStarted
✔ Successfully pulled backend environment dev from the cloud.
✅ 
Updating Xcode project:
-- Amplify project found.
-- Amplify config files found.
-- Successfully updated project /Users/ec2-user/amplify-ios-getting-started/code.
🚫 folderNotFound: Amplify generated models not found at /Users/ec2-user/amplify-ios-getting-started/code/amplify/generated/models
-- Recovery suggestion: Run amplify codegen models.
🛑 Command failed with exit code 1: /Users/ec2-user/.amplify/lib/aws-amplify-amplify-frontend-ios/resources/amplify-xcode import-models --path=/Users/ec2-user/amplify-ios-getting-started/code

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: d0eb4eb5-e111-4386-8616-1f601be265f8
➜
 amplify diagnose --send-report

Learn more at https://docs.amplify.aws/cli/reference/diagnose/

✅ Report saved: /var/folders/xp/j9q471m15m5by0r9q5pvst1r0000gn/T/iOSGettingStarted/report-1694209029491.zip

✔ Done

Project Identifier: 3781fad98a5f311089fdb50c344822c2

Expected behavior

Amplify CLI should not try to located the generated src directory at the moment of the pull.

Reproduction steps

git clone https://github.com/sebsto/amplify-ios-getting-started.git

cd amplify-ios-getting-started

 ./code/ci_actions/02_amplify.sh

Project Identifier

3781fad98a5f311089fdb50c344822c2

Log output

# Put your logs below this line
2023-09-08T21:29:00.956Z|info : amplify diagnose core  {"send-report":true,"yes":false}
2023-09-08T21:29:00.985Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-09-08T21:36:35.909Z|info : amplify pull core  [***]{"amplify":"{\"projectName\":\"[***]Started\",\"appId\":\"[***]9eqxz2\",\"envName\":\"[***]ev\",\"[***]ultEditor\":\"code\"}","frontend":"{\"frontend\":\"ios\"","}":true,"providers":"{\"awscloudformation\":{\"configLevel\":\"general\",\"useProfile\":true,\"profileName\":\"default\"}}","yes":true,"region":"eu-central-1"}
2023-09-08T21:36:35.940Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-09-08T21:36:36.812Z|info : amplify-provider-awscloudformation.amplify-service-permission-check.checkAmplifyServiceIAMPermission.amplifyClient.listApps([])
2023-09-08T21:36:37.240Z|info : amplify-provider-awscloudformation.attach-backend.getAmplifyApp.amplifyClient.getApp([{"appId":"[***]9eqxz2"}])
2023-09-08T21:36:37.579Z|info : amplify-provider-awscloudformation.attach-backend.getBackendEnv.amplifyClient.getBackendEnvironment([{"appId":"[***]9eqxz2","environmentName":"[***]ev"}])
2023-09-08T21:36:37.928Z|info : amplify-provider-awscloudformation.attach-backend.downloadBackend.s3.getObject([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]started-[***]ev-[***]022-[***]ment"}])
2023-09-08T21:36:39.361Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2023-09-08T21:36:39.361Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]started-[***]ev-[***]022-[***]ment"}])
2023-09-08T21:36:39.936Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]started-[***]ev-[***]022"}])
2023-09-08T21:36:39.944Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]started-[***]ev-[***]022"}])
2023-09-08T21:36:40.505Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]started-[***]ev-[***]022"}])
2023-09-08T21:36:41.091Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:eu-[***]ral-[***]93:stack/[***]ify-[***]started-[***]ev-[***]022-[***]gstarted-[***]JJYGM/[***]bf20-[***]ab-[***]ec-[***]d1-[***]8e8c8"}])
2023-09-08T21:36:41.092Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:eu-[***]ral-[***]93:stack/[***]ify-[***]started-[***]ev-[***]022-[***]rted2ee74a53-[***]CQGAC/[***]5850-[***]37-[***]ec-[***]80-[***]3ac92"}])
2023-09-08T21:36:41.093Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:eu-[***]ral-[***]93:stack/[***]ify-[***]started-[***]ev-[***]022-[***]image-[***]B8EQ2/[***]d960-[***]41-[***]ec-[***]34-[***]19420"}])
2023-09-08T21:36:41.605Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]started-[***]ev-[***]022-[***]ment"}])
2023-09-08T21:36:42.192Z|info : amplify-provider-awscloudformation.CognitoUserPoolService.listUserPool.cognito.listUserPools([{"params":{"MaxResults":60}}])
2023-09-08T21:36:42.606Z|info : amplify-provider-awscloudformation.CognitoUserPoolService.listUserPoolIdentityProviders.cognito.listIdentityProviders([{"UserPoolId":"[***]u-[***]ral-[***]yKqf2","MaxResults":60}])
2023-09-08T21:36:42.946Z|info : amplify-provider-awscloudformation.CognitoUserPoolService.listUserPoolIdentityProviders.cognito.describeIdentityProviderPromises([{"UserPoolId":"[***]u-[***]ral-[***]yKqf2","ProviderName":"[***]hApple"}])
2023-09-08T21:36:57.486Z|info : amplify diagnose core  {"send-report":true,"yes":false}
2023-09-08T21:36:57.516Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-09-08T21:37:09.415Z|info : amplify diagnose core  {"send-report":true,"yes":false}
2023-09-08T21:37:09.449Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}

Additional information

No response

Before submitting, please confirm:

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

sebsto avatar Sep 08 '23 21:09 sebsto

Might be related to https://github.com/aws-amplify/amplify-cli/issues/13202

sebsto avatar Sep 08 '23 21:09 sebsto

Workaround

  1. manually create the generated/models directory before the amplify pull
  2. run amplify pull, it fails with the error message described above
  3. run amplify pull a second time. It succeeds

Here is my code

# double command execution, this is a workaround for issue https://github.com/aws-amplify/amplify-swift/issues/3307
$AMPLIFY_CLI pull \
--amplify $AMPLIFY \
--frontend $FRONTEND \
--providers $PROVIDERS \
--yes \
--region $BACKEND_REGION || \
echo "First amplify pull failed, applying workaround for Amplify CLI Issue # 13201" && \
mkdir -p $CODE_DIR/amplify/generated/models && \
$AMPLIFY_CLI pull \
--amplify $AMPLIFY \
--frontend $FRONTEND \
--providers $PROVIDERS \
--yes \
--region $BACKEND_REGION

sebsto avatar Sep 08 '23 23:09 sebsto

Hey @sebsto we were able to successfully reproduce this issue. Marking as a bug and investigating further while we assess the issue

josefaidt avatar Sep 13 '23 23:09 josefaidt

Hey @josefaidt any progress on this issue ? I would like to demonstrate an amplify pull during a session at AWS re:Invent conference in November and would love to avoid to explain the workaround.

sebsto avatar Oct 18 '23 16:10 sebsto

Hey @sebsto apologies for the delay. I've transferred this over to our Swift repo for better assistance with the amplify-xcode execution post-init

josefaidt avatar Oct 18 '23 17:10 josefaidt

Thank you ! Is there a new issue ID I can track on the new repo ?

sebsto avatar Oct 18 '23 18:10 sebsto

Hey @sebsto. The issue was transferred to the amplify-swift repo, so a bookmarked link will redirect you here.

  • https://github.com/aws-amplify/amplify-swift/issues/3307

We're looking into this and will provide updates here. Thanks.

atierian avatar Oct 23 '23 17:10 atierian

@atierian Hello Ian, can we get a bit of love on this one :-) ? Or just a status

sebsto avatar Feb 20 '24 09:02 sebsto

@sebsto Thanks for bringing this to our attention.. I will spend some time on this and see what going on.

harsh62 avatar Feb 20 '24 19:02 harsh62

Quick update: The fix has been merged in amplify-swift and is awaiting amplify-cli teams review.

harsh62 avatar Feb 26 '24 22:02 harsh62

The issue has been released. Please update amplify cli using amplify upgrade.

harsh62 avatar Apr 29 '24 13:04 harsh62

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Apr 29 '24 13:04 github-actions[bot]

Thank you for bringing this to resolution. I just tested with amplify CLI version 12.11.1 and it works

sebsto avatar Apr 29 '24 18:04 sebsto