`: Error: Cannot find module 'chrome-aws-lambda'\n...
# help
d
: Error: Cannot find module 'chrome-aws-lambda'\nRequire stack: /Users/me/Projects/idx/.sst/artifacts/klick-packages
Getting this when trying to
sst start
from a SST app that imports a
yarn linked
construct that in-turn implements a lambda that “should” be implementing a layer with ``chrome-aws-lambda` in it. Any ideas how to fix so I can test this function? Does
sst.Function
implement layers when using
sst start
?
Or perhaps thats the issue… the function is running on my local machine (
sst start
) and that doesn’t have the layer?
@thdxr Is there a recommended way to handle
sst start
and lambda layers?
I tried removing the layer, and the
externalModules
from the
sst.Function
and then added
chrome-aws-lambda
and
puppeteer-core
devDeps to my package. Now I’m getting….
{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Runtime.ImportModuleError: Error: Cannot find module '/Users/me/Projects/idx/.sst/artifacts/klick-packages/packages/cdk-constructs/assets/social-cards/puppeteer/lib/Browser
Just tried adding
puppeteer-core
,
chrome-aws-lambda
and
puppeteer
as devDeps…. still getting the above error. Now I’m stuck, not sure what else to try.
Lost hope in getting
sst start
to work just deploying fully each time and debugging with CWL. 😭
Read this going to try again and seen if anything different? https://github.com/alixaxel/chrome-aws-lambda/wiki/HOWTO:-Local-Development#workaround
t
hey - so we don't have a way of unpackaging the layer and making it available in sst start
what I usually do is just add the dependencies normally and then when deploying I mark them external
d
how can I get this to work… even if I turn off the layer…. doesn’t seem to work
t
bundle.external = app.local ? [] : ["puppeteer-core"]
let me see I might have some old example code
d
externalModules doesnt seem to work…. likely maybe do to the other layer of problem is that this is a yarn linked construct that implements sst.Function
t
yeah yarn links esp in a monorepo I've run into all sorts of headaches with
d
I’ve made those 3x packages
nohoist
so they will still be in the same nm folder
but I keep getting error saying it can’t find the module
Can you explain WHERE the function expects the node_modules to be when
sst start
?
where, and in relation to what
t
we run the function wherever sst.json is currently
so it runs at the root
we should probably be running it where
srcPath
is
d
k let me try something
maybe if I add those three to the sst.json root package.json then
WORKS!
WOW Thanks @thdxr!!!! free’d me up…. now back to work!
smaller quick Q, is there a way to manual force a function deploy with sst start when watch can’t see the change?
right now I’m restarting sst start each time
t
wondering why watch can't see the change
we currently watch inside the srcPath
but force reloading the function is probably a feature we should add to our console
d
cause its a linked in construct
t
ah yeah restarting is probably the only thing you can do rn
d
kk nw
thanks again!
would be good if you could optionally add watch props to get it to watch a folder or all of node_modules