How to package the function to always be as "root" #9958
arditshala
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When you have multiple functions in one configuration, you usually end up having something like this:
However, when sls is deploying this, the package (ZIP) has a structure like this, where the handler is:
/functions/foo/bar/index.js
However, different NPM packages and dependencies expect the handler to be root directory itself, ex. the
config
(node-config) module expects so and when that module tries to read the filesystem for the /config directory it can't, bcs the config directory is not actually at '/functions/foo/bar/config'.Is there any way one can package the function to be the root folder, so copy everything from
/function/foo/bar/**
and let that be the directory and zip that one up and deploy to AWS?So you can actually say
fs.readdirSync('./config')
instead offs.readdirSync('./functions/foo/bar/config')
on theindex.js
(handler).Beta Was this translation helpful? Give feedback.
All reactions