I’m creating the edge function via ```const edgeFu...
# help
t
I’m creating the edge function via
Copy code
const edgeFunc = new experimental.EdgeFunction(this, "WebsiteEdge", {
      runtime: Runtime.NODEJS_12_X,
      handler: "test.handler",
      code: Code.fromAsset("src/test"),
      stackId: `${scope.logicalPrefixedName("edge-lambda")}`,
    });
f
Hey @Tobias Otte, can you show me the dependencies in ur package.json?
t
Copy code
"devDependencies": {
    "@aws-cdk/assert": "1.105.0",
    "@types/aws-lambda": "^8.10.77"
  },
  "dependencies": {
    "@aws-cdk/core": "1.105.0",
    "@serverless-stack/cli": "0.30.0",
    "@serverless-stack/resources": "0.30.0"
  }
f
hmm.. that looks right..
are you getting this error on
sst deploy
?
t
Yep
f
I’m afk.. I will give it a try in a bit
Hey @Tobias Otte, looking at the error message:
Copy code
Error: ENOENT: no such file or directory, copyfile '/xxx/node_modules/@aws-cdk/core/lib/custom-resource-provider/nodejs-entrypoint.js' -> '/xxx/bridy/.build/lib/edge-function/__entrypoint__.js'
Can you confirm if ur SST app is sitting inside
bridy/
off the repo root? ie. folder structure is:
Copy code
/
  node_modules/
  bridy/
    sst.json/
t
sorry, no. that is just me cleaning the error message up. sst.json and node modules are both in root.
f
I see. Can you try removing the
node_modules
, and
package-lock.json
or `yarn.lock`; install the node modules; then try running
sst deploy
again?
t
Same error I’m afraid 😕
f
hmm can you check if the
/xxx/node_modules/@aws-cdk/core/lib/custom-resource-provider/nodejs-entrypoint.js
exists?
t
Yep, it’s there
f
Hey @Tobias Otte, I created a test SST app with the StaticSite + Lambda@Edge setup https://github.com/fwang/sst-edge-lambda-test
It seems to work for me. Give it a try and see if it works for you?
t
I’ve figured it out. I was missing
@aws-cdk/aws-cloudfront
and
@aws-cdk/aws-lambda
in dependencies 🤦‍♂️
Strange error, though.
f
Ah I see. Glad u figured it out!