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

unhelpfull error message when adding an new lambda function with same name #12554

Open
2 tasks done
ykethan opened this issue May 1, 2023 · 1 comment
Open
2 tasks done
Labels
bug Something isn't working functions Issues tied to the functions category good first issue Good for newcomers ops-errors Operational theme: centralized error messaging p4

Comments

@ykethan
Copy link
Member

ykethan commented May 1, 2023

How did you install the Amplify CLI?

No response

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

No response

Amplify CLI Version

11.1.1

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

when adding a lambda function with a same name. The CLI throws the follow error message

<function-name> is present in amplify-meta.json

while the error message is minimal, the message is not helpfull

Expected behavior

throw error message -> Function with name <function-name> already present in the project. create the function with a new name

Reproduction steps

  1. amplify add function -> name as test
  2. amplify add function -> name as test
  3. observe error

Project Identifier

No response

Log output

# Put your logs below this line


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 ykethan added pending-triage Issue is pending triage functions Issues tied to the functions category labels May 1, 2023
@josefaidt
Copy link
Contributor

josefaidt commented May 1, 2023

Hey @ykethan I was able to successfully reproduce this issue using the latest version of Amplify CLI (11.1.1). This also appears to print a stack trace without using --debug, for which I'll add the ops-errors label.

➜  amplify add function
? Select which capability you want to add: Lambda function (serverless function)
? Provide an AWS Lambda function name: test
? Choose the runtime that you want to use: NodeJS
? Choose the function template that you want to use: Hello World

Available advanced settings:
- Resource access permissions
- Scheduled recurring invocation
- Lambda layers configuration
- Environment variables configuration
- Secret values configuration

? Do you want to configure advanced settings? No
Error: test is present in amplify-meta.json
    at AmplifyToolkit.updateamplifyMetaAfterResourceAdd (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/update-amplify-meta.js:127:15)
    at createFunctionResources (/snapshot/repo/build/node_modules/@aws-amplify/amplify-category-function/lib/provider-utils/awscloudformation/utils/storeResources.js:47:21)
    at addFunctionResource (/snapshot/repo/build/node_modules/@aws-amplify/amplify-category-function/lib/provider-utils/awscloudformation/index.js:88:56)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.executeAmplifyCommand (/snapshot/repo/build/node_modules/@aws-amplify/amplify-category-function/lib/index.js:277:5)
    at async executePluginModuleCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:135:5)
    at async executeCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:33:9)
    at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:117:5)
There was an error adding the function resource

Marking as a bug.

@josefaidt josefaidt removed their assignment May 1, 2023
@josefaidt josefaidt added bug Something isn't working ops-errors Operational theme: centralized error messaging good first issue Good for newcomers p4 and removed pending-triage Issue is pending triage labels May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working functions Issues tied to the functions category good first issue Good for newcomers ops-errors Operational theme: centralized error messaging p4
Projects
None yet
Development

No branches or pull requests

2 participants