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

Why do we need projectPath in amplify/.config/local-env-info.json? it cause an issue if the project folder is renamed #13537

Open
2 tasks done
ArsSirek opened this issue Jan 16, 2024 · 3 comments
Labels
feature-request Request a new feature platform-config Issues related to configuring project settings

Comments

@ArsSirek
Copy link

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

What operating system are you using?

ubuntu

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

No

Describe the bug

I renamed the folder of the project, and the command like amplify update auth started to ignore all existing parameters

Expected behavior

The rename (or move) of the folder that contains the project has no side effect on the project.

I think we can use only relative paths to find the parameter files just like we find the amplify-meta.json

the issue is caused by this lines if we instead relay on search project root like we do here that will resolve this kind of errors

Reproduction steps

  1. init an amplify project
  2. execute amplify add auth
  3. rename the project folder
  4. execute amplify update auth
    And you won't see any of the values you configured on amplify add auth the cli will suggest new names for cognito user pool and identity pool

Project Identifier

No response

Log output

No response

Additional information

One can fix the issue caused by moving the project folder by manually changing the path in the amplify/.config/local-env-info.json but it took a few days from me to figure out what was the issue in the first place.
here is my question at re:Post
and in discord server

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.
@ArsSirek ArsSirek added the pending-triage Issue is pending triage label Jan 16, 2024
@ykethan
Copy link
Contributor

ykethan commented Jan 16, 2024

Hey @ArsSirek, thank you for reaching out. To update the project info, we can run amplify configure project which should update the project path as well. Marking this as Feature request.

@ykethan ykethan added feature-request Request a new feature platform-config Issues related to configuring project settings and removed pending-triage Issue is pending triage labels Jan 16, 2024
@ArsSirek
Copy link
Author

ArsSirek commented Jan 16, 2024

Hi @ykethan! thank you for your response and for looking into this issue!

You know better what labels suite the issue best, as people can put different meaning to the same words.

But It took days to debug the issue for me, so I personally I would still think that this issue is rather a bug then a feature request, because one don't expect to break a project by renaming the folder. It is a totally unexpected side effect and the error messages are not helping to find the direction at all.

The command to fix the path is cool, but you still need to somehow know ahead of time that changing the folder path cause problems for amplify cli

@ArsSirek
Copy link
Author

I guess I should have added initial error logs as well, so people with similar errors will be able to find this issue and the solution.

Error on amplify push when hard-coded project path cache is invalid

🛑 The following resources failed to deploy:
Resource Name: storages3 (AWS::CloudFormation::Stack)
Event Type: update
Reason: Parameters: [bucketName, unauthRoleName, unauthPolicyName, authRoleName, authPolicyName] must have values

Errors on amplify update auth when hard-coded project path cache is invalid

Error: Data did not validate against the supplied schema. Underlying errors were [
  {
    "keyword": "type",
    "dataPath": ".cognitoConfig.usernameAttributes",
    "schemaPath": "#/definitions/ServiceQuestionsBaseResult/properties/usernameAttributes/type",
    "params": {
      "type": "array"
    },
    "message": "should be array"
  }
]
    at CLIInputSchemaValidator.validateInput (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-cli-core/lib/category-interfaces/category-base-schema-generator.js:121:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async AuthInputState.saveCLIInputPayload (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/provider-utils/awscloudformation/auth-inputs-manager/auth-input-state.js:79:13)
    at async /snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/provider-utils/awscloudformation/handlers/resource-handlers.js:116:9
    at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/commands/auth/update.js:94:40)
    at async Object.executeAmplifyCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/index.js:347:5)
    at async executePluginModuleCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:139:5)
    at async executeCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:37:9)
    at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:121:5)
🛑 There was an error updating the auth resource
Error: PreSignup is present in amplify-meta.json
    at AmplifyToolkit.updateamplifyMetaAfterResourceAdd (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/update-amplify-meta.js:131:15)
    at createFunctionResources (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-function/lib/provider-utils/awscloudformation/utils/storeResources.js:47:21)
    at addFunctionResource (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-function/lib/provider-utils/awscloudformation/index.js:88:56)
    at Object.addResource (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-function/lib/provider-utils/awscloudformation/index.js:51:20)
    at add (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-function/lib/index.js:85:31)
    at AmplifyToolkit.invokePluginMethod (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/invoke-plugin-method.js:44:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async AmplifyToolkit.addTrigger (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/trigger-flow.js:59:5)
    at async handleTriggers (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/provider-utils/awscloudformation/utils/trigger-flow-auth-helper.js:64:35)
    at async lambdaTriggers (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/provider-utils/awscloudformation/utils/synthesize-resources.js:119:32)
    at async getResourceUpdater (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/provider-utils/awscloudformation/utils/synthesize-resources.js:57:5)
    at async /snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/provider-utils/awscloudformation/handlers/resource-handlers.js:105:5
    at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/commands/auth/update.js:94:40)
    at async Object.executeAmplifyCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-auth/lib/index.js:347:5)
    at async executePluginModuleCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:139:5)
    at async executeCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:37:9)
    at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:121:5)
🛑 There was an error adding the auth resource

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature platform-config Issues related to configuring project settings
Projects
None yet
Development

No branches or pull requests

2 participants