Comments (5)
Having the same issue here.
from aws-pdk.
Hi I am sorry you are running into this issue.
- Can you please send me what your build spec looks like and also what image you are using?
- How often are you seeing this issue?
- Ideally seeing full logs would help me debug further.
- To resolve this error are you simply restarting the build action?
from aws-pdk.
I was able to reproduce this locally by running this command in parallel:
npx --yes -p @aws/pdk type-safe-api.clean-openapi-generated-code --code-path .
What is happening is:
Process 1 creates a new directory and starts installing the @aws/pdk
dependencies in to the /root/.npm/_npx/
folder
Process 2 comes in and tries to do the same thing which is leading to a corruption in this directory. This also explains why it fails on CI but not locally as in CI the /root/.npm/_npx/
will be empty wheras locally it will most likely already have the packages installed.
I am not sure why this is presenting more now, however this would have been an issue for quite some time as apparently npx and dlx are not concurrency-safe. What is interesting is this issue is only present if the /root/.npm/_npx/
folder does not have @aws/pdk
and if the folder you are currently running in doesn't have PDK installed (which it should). The resolution path should looks as follows:
1.) Check all node_modules
folders starting with the current folder, traversing upward to see if @aws/pdk@$AWS_PDK_VERSION
exists.
2.) Fall back to global node_modules
located in /root/.npm/_npx/
.
I would have assumed that 1) should be resolved as the build command would be called after performing an install. In the event it falls back to 2), this will create a new folder and is where the issue you are seeing is occuring.
Can you please confirm that you have @aws/pdk
installed within your local node_modules
and it matches the version listed in your $AWS_PDK_VERSION
(you can find this in the .projen/tasks.json file)?
As a stop gap there are two options:
Option 1 - Preload the package into the npx cache (recommended)
Add this before your build command: npx --yes -p @aws/pdk@<YOUR_PDK_VERSION> pdk --version
.
Replace <YOUR_PDK_VERSION>
with the same AWS_PDK_VERSION found within .projen/tasks.json
. This will ensure that the package is already present in the npx cache and when the scripts are executed within the build command, it won't try to download the package in parallel (which is where the problem stems).
Option 2 - Force your build to run serially
Append the --parallel 1
flag to your build command to force each package to build in parallel.
Note: This will slow down your build.
I would advise you to try Option 1 and report back whether this helps resolve your issue. If so I will go ahead and raise a PR to incorporate Option 1 into the PDK so you don't have to explicitly perform that step.
from aws-pdk.
To add to this, there may be other stages in the build process that rely on just in time packages like for example if using pnpm, there is a pnpm dlx
command that is equivalent to npx
which will run into the same problems. We may need to perform this precaching step for these instances also i.e: pnpm --package=@aws/pdk dlx pdk --version
.
from aws-pdk.
The issue seems to be related to the release of the latest version of pnpm, version 9. After pinning the version to version 8, the build succeeds.
from aws-pdk.
Related Issues (20)
- [BUG] Cannot find module '[...]/node_modules\node_modules\projen\bin\projen' if outdir without a subfolder in path HOT 3
- [BUG] (cdk-graph-plugin-threat-composer) Generated architecture image too large for threat composer HOT 2
- [FEATURE] Change release workflow to be scheduled fortnightly
- [FEATURE] Create/Publish a Docker Image containing all required PDK dependencies
- [BUG] Static Website deployments fail due to throttling when WebACL configuration is included
- [BUG] Projects which set licensed to false emitting Apache 2.0
- [FEATURE] (type-safe-api) WebSocket API support for Java
- [FEATURE] (type-safe-api) WebSocket API support for Python
- [FEATURE] (type-safe-api) WebSocket API Documentation Generation HOT 1
- [BUG] (type-safe-api) web acl names conflict for multiple apis in same stack with same logical id HOT 1
- [BUG] Support for python project version ranges HOT 2
- [BUG] npm ci fails after installing @aws/pdk HOT 7
- [FEATURE] (type-safe-api) Support service-less TypeSafeApiModelProject HOT 2
- [BUG] pnpm 9 sets link-workspace-packages to false by default
- [FEATURE] replace deprecated @aws-sdk packages HOT 2
- [BUG] licensed: false setting does not work as expected. HOT 1
- [BUG] (type-safe-api) PrepareSpecCustomResource fail with error 413 in large API with many integrations HOT 3
- [BUG] Task "build ยป compile ยป generate" failed when executing "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.copy-gradle-wrapper" HOT 4
- [BUG] aws-pdk container missing depencency required for vscode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-pdk.