Having an issue getting the lambda serializer to b...
# general
b
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
b
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
Huh - that is surprising. If you can open an issue with a repro we can take a look.
b
sure I’ll make one with the example layout that’s serializing funny on my end
thanks!