https://pulumi.com logo
#general
Title
# general
b

billions-lock-73409

02/14/2020, 5:55 PM
Having an issue getting the lambda serializer to bundle a file that’s
required
at the top of the handler. It’s relative to the main lambda file yet won’t pull it in.
I’ve tried forcing it by using
Copy code
codePathOptions: {
        extraIncludePaths: ['./infra/prod/*redacted*/lambda/api/request_forms.js'],
    },
The only way I got it bundled was using the full path from the root of my pulumi project
yet it’s being required like so
const requestForms = require('./request_forms');
Also this is very relevant to what I’m trying to do https://pulumi-community.slack.com/archives/C84L4E3N1/p1573590289254500 except it seems their folder structure is flat
So I managed to trick it into working, instead of my
request_forms.js
file exporting my express-routes instance, i wrapped it all in a generator function that just returns the variable i need. Does the JS Serializing logic check for use of parameters on imported files?
Has my use of
_aws_._lambda_._CallbackFunction_
gone past the intended use? I’m trying to
require
in additional files and the serializer isn’t detecting that, so the files aren’t available in the final bundle.
w

white-balloon-205

02/17/2020, 6:44 PM
b

billions-lock-73409

02/17/2020, 6:47 PM
Hey Luke, I did try doing that however the file gets pulled into the bundle at an absolute path
extraIncludePaths: ['./infra/prod/redacted/lambda/api/request_forms.js'],
instead of where it is expected,
./request_forms.js
w

white-balloon-205

02/17/2020, 6:48 PM
Huh - that is surprising. If you can open an issue with a repro we can take a look.
b

billions-lock-73409

02/17/2020, 6:49 PM
sure I’ll make one with the example layout that’s serializing funny on my end
thanks!
2 Views