https://serverless-stack.com/ logo
#help
Title
# help
k

Kevin Grimm

05/10/2022, 12:45 PM
Morning all. I'm trying to run
npx sst start
which throws the following error
Copy code
Error: Cannot find asset at my-app/node_modules/aws-cdk-lib/lambda-layer-awscli/lib/layer.zip
    at new AssetStaging (my-app/node_modules/aws-cdk-lib/core/lib/asset-staging.ts:166:13)
    at new Asset (my-app/node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.ts:131:21)
    at AssetCode.bind (my-app/node_modules/aws-cdk-lib/aws-lambda/lib/code.ts:282:20)
    at new LayerVersion (my-app/node_modules/aws-cdk-lib/aws-lambda/lib/layers.ts:196:29)
    at new AwsCliLayer (my-app/node_modules/aws-cdk-lib/lambda-layer-awscli/lib/awscli-layer.ts:11:5)
    at new NextjsSite (my-app/node_modules/@serverless-stack/resources/src/NextjsSite.ts:135:24)
    at new MyStack (my-app/stacks/MyStack.js:225:18)
    at Object.main (my-app/stacks/index.js:10:3)
    at Object.<anonymous> (my-app/.build/run.js:94:16)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
So I've then proceeded to install the missing asset with
npm i @aws-cdk/lambda-layer-awscli
Rerunning
npx sst start
will then advise that I upgrade AWS CDK packages to V2
Copy code
Preparing your SST app
(node:29303) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

Update the following AWS CDK packages to v2:

  - @aws-cdk/lambda-layer-awscli

More details on upgrading to CDK v2: <https://github.com/serverless-stack/serverless-stack/releases/tag/v0.59.0>

AWS CDK packages need to be updated.
Here's my
package.json
Copy code
{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "test": "sst test",
    "start": "sst start",
    "build": "sst build",
    "deploy": "sst deploy",
    "remove": "sst remove"
  },
  "eslintConfig": {
    "extends": [
      "serverless-stack"
    ]
  },
  "dependencies": {
    "@aws-cdk/lambda-layer-awscli": "^1.155.0",
    "@aws-sdk/client-dynamodb": "^3.72.0",
    "@aws-sdk/client-lambda": "^3.72.0",
    "@aws-sdk/client-ses": "^3.82.0",
    "@aws-sdk/client-sesv2": "^3.82.0",
    "@aws-sdk/client-sns": "^3.72.0",
    "@aws-sdk/lib-dynamodb": "^3.72.0",
    "@mailchimp/mailchimp_marketing": "^3.0.74",
    "@serverless-stack/cli": "0.69.6",
    "@serverless-stack/resources": "0.69.6",
    "@sls-next/lambda-at-edge": "^3.7.0",
    "aws-cdk-lib": "2.15.0",
    "md5": "^2.3.0"
  }
}
It doesn't appear that
aws-cdk/lambda-layer-awscli
has a V2 package looking at the versions here - https://www.npmjs.com/package/@aws-cdk/lambda-layer-awscli And my versions of SST and CDK are SST: 0.69.6 CDK: 2.15.0 I found a thread with a similar issue though that seemed to be resolved by a new SST upgrade. Thinking that I've likely missed a step with the V2 migration or have mismatching versions of SST somewhere in my settings
Ok, I nuked my
node_modules
folder and removed
*aws-cdk*
dependences from the
package.json
. Working now
t

thdxr

05/10/2022, 1:27 PM
rite of passage 😄