Type error: Cannot find module '$amplify/env/say-hello' or its corresponding type declarations. #1545
Closed
2 tasks done
Labels
duplicate
This issue or pull request already exists
pending-response
Issue is pending response from author
pending-triage
Incoming issues that need categorization
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v20.12.2
Amplify CLI Version
amplify gen2, 12.11.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
I am following the template tutorial of Gen2 for nextjs page router . When trying to add the environment variables for a new function, the CDK deployment failed when running "npm run build":
the error message is
Type error: Cannot find module '$amplify/env/say-hello' or its corresponding type declarations.
I do have my
amplify/tsconfig.json
file configured (which is generated by thenpx amplify create
command):@/amplify/tsconfig.json
@/tsconfig.json
here is the file structure:
Expected behavior
expect the deploy to success.
Are there any special configuration for typescript? It looks like a compiling problem.
Reproduction steps
Project Identifier
No response
Log output
Additional information
No response
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: