Artem Kalantai  [10:01 AM] HEEEELP!! again, unexpe...
# help
a
Artem Kalantai  [10:01 AM] HEEEELP!! again, unexpectedly I started to have this stupid error
Copy code
{
  "errorType": "Runtime.ImportModuleError",
  "errorMessage": "Error: Cannot find module 'punycode/'\nRequire stack:\n- /var/task/googleDriveToS3.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
  "stack": [
    "Runtime.ImportModuleError: Error: Cannot find module 'punycode/'",
    "Require stack:",
    "- /var/task/googleDriveToS3.js",
    "- /var/runtime/UserFunction.js",
    "- /var/runtime/index.js",
    "    at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
    "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
    "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
    "    at Module._compile (internal/modules/cjs/loader.js:999:30)",
    "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
    "    at Module.load (internal/modules/cjs/loader.js:863:32)",
    "    at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
    "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)",
    "    at internal/main/run_main_module.js:17:47"
  ]
}
[10:02 AM] it was working as usual, but at some point I started to have this error, when I use it through my machine - everything ok, previously I had the same issue and only what helped is remove all stack and create from scratch, but I can’t do it on prod Artem Kalantai  [10:59 AM] nothing help…..
f
Hey @Artem Kalantai, you said “when I use it through my machine - everything ok”. Where are you getting this error then?
a
when I’m doing “sst start” so proxy debug mode, it is ok, but when I deploy on aws “sst deploy” it doesn’t work, this error I had before, at some point it disappeared itself, not sure why and now it happens again ON PROD!
the worst thing, it is unreproducable
i mean it happens for me once, then disappeared and now again, so i don't know the reason, and probably will work fine for you
so how to find the reason i can't imagine
f
Just to clarify a few things: • is
sst deploy
failing with this error? Or is this a Lambda runtime error? • are you running
sst deploy
locally or thru a CI environment? • you said it works now, did you redeploy to get it to work? Or have u not deployed and it magically worked again?
a
1. lambda runtime error
2. locally
3. “it works now” the function that wasn’t working before with the same issue
right now I found that if I remove all code from the function is starts working
so I’m returning code back line by line and looking which fucking line cause this
looks like it is some sort of cycle dependencies, not sure, ddigging
I fixed, it wasn’t related to sst at all, I was realated to dynamoose lib that I’m using for dynamo
f
oh nice! Glad u got it working 🤓
d
Figuring out this issue now haha. Slowly reducing the problem space.
Figured it out! Interesting case - I figured exporting a couple constants from a file that declares a CDK stack and sharing it with application code directly was fine. No. You'll run into this issue after build (but not local). If you ever want to share constants between cdk and app code, do extract into a separate module