-
Notifications
You must be signed in to change notification settings - Fork 822
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
Custom resource fails to build in yarn workspace with error “TypeScript executable not found” #11851
Comments
Hey @acusti 👋 thanks for raising this! Do you have the |
i do! i originally just had: ["<amplify-root>", "<amplify-root>/amplify/backend", "<amplify-root>/amplify/backend/custom/*", "<amplify-root>/amplify/backend/function/*/src"] (where |
Hey @acusti thanks for clarifying! May I ask what is the intended use case for including these in your workspaces? Is it purely to share modules and reduce the |
do you mean what is the intended use case for including |
Hey @acusti thanks for clarifying, and that seems reasonable to me! I really enjoy the writeup as well! I'll mark this as a bug 🙂 thank you for taking the time to file the PR!! |
as a quick follow-up, i used |
@acusti I'm not able to reproduce the issue. I followed your steps, created a yarn workspace with just two directories, amplify app root and the custom resource root like "workspaces": [
"app1", "app1/amplify/backend/custom/customResourceb4d43d64"
], Then running yarn install from the root, deletes all the packages from the (base) ➜ <my yarn ws> tree app1/amplify/backend/custom/customResourceb4d43d64/node_modules/ -a
app1/amplify/backend/custom/customResourceb4d43d64/node_modules/
└── .bin
├── tsc -> ../../../../../../../node_modules/typescript/bin/tsc
└── tsserver -> ../../../../../../../node_modules/typescript/bin/tsserver
2 directories, 2 files and so I'm also using yarn 1.22.19. Is there any other configuration that I'm missing? |
To reproduce, use the following {
"private": true,
"version": "0.0.1",
"workspaces": [
"packages/*",
"apps/*",
"amplify/backend/*",
"amplify/backend/custom/*"
],
"devDependencies": {
"typescript": "^4.9.5"
}
} create your Amplify project and add a custom resource: amplify init -y
amplify add custom # select cdk you will notice git init
git clean -fXd From here, attempt to re-initialize your project
Observe it will fail building resources with the error described here
|
Hey @acusti this issue appears to be fixed with the release of Amplify CLI 10.7.0! Can you try upgrading and see if this issue is still occurring for you? As a note, the issue lies with the lack of node_modules on |
@josefaidt thanks for the update! i just upgraded to the latest amplify CLI, and it did indeed resolve my issue. also, i updated my PR (#11854) based on your suggestion in #11889, which i thought was a good one. |
Hey @acusti glad to hear that resolved the issue for you! And thank you for updating the PR! We'll close this issue for now, but the team will evaluate the PR 🙂 |
How did you install the Amplify CLI?
yarn
If applicable, what version of Node.js are you using?
v18.7.0
Amplify CLI Version
10.6.2
What operating system are you using?
macOS 13.1
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Describe the bug
i have a monorepo using yarn 1.22.19 workspaces in which i have installed amplify. i also have a custom resource as a part of my amplify setup defined via a
cdk-stack.ts
file. when i try to runamplify push
, i get the following error:this error is generated from the utils/build-custom-resources.ts file: https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-category-custom/src/utils/build-custom-resources.ts#L89-L92, and it occurs because that file is manually attempting to find the
tsc
executable within thebackend/custom/{CustomResourceName}/node_modules/.bin
directory:so if the
tsc
executable has been hoisted to the workspace route, that path fails thefs.existsSync(localTscExecutablePath)
check and the process throws an error.Expected behavior
i expected the
buildResource
util to work even if dependencies have been hoisted.Reproduction steps
/web
in my example) and runamplify init
in that root directorytsc
executable exists in the workspace root’snode_modules/.bin/
directory but not in the custom resource’snode_modules/.bin/
directoryamplify push
Project Identifier
Project Identifier: 4cce2c1871372609297d98c2261bc65e
Log output
Additional information
No response
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: