in that way, xapi will have the correct path to itself
What am i missing:
Due to lambda nature, it is expected to close any db connection after any request, or the lambda won't exit until timeout (30 secs for api gateway lambda) and we will get an error in the log.
So we need a way to: or close destroy xpi, and create new one for each request,
Or a way to "suspend"/"resume" it, that will close to mysql connection and restore it on demand.
Both ways have advantages and disadvantages (i can elaborate)
When i will finish to set up all of my stuff i will be happy to create an example project
I want to share my progress with integrating it with lambda, and also to ask related questions.
My use case is that i have existing serverless project, and i want to add xapi under specific route.
First you need to
import colors = require("colors");
(or require if not typescript or whatever)What works for me: I'm using https://github.com/awslabs/aws-serverless-express Which is the official lambda -> express compat layer (and not serverless-http)
To make xapi work properly under subpath:
apiPrefix: "/expressApp/xapi/",
And im mounting the express app that im passing to xapi under subroute
in that way, xapi will have the correct path to itself
What am i missing: Due to lambda nature, it is expected to close any db connection after any request, or the lambda won't exit until timeout (30 secs for api gateway lambda) and we will get an error in the log. So we need a way to: or close destroy xpi, and create new one for each request, Or a way to "suspend"/"resume" it, that will close to mysql connection and restore it on demand.
Both ways have advantages and disadvantages (i can elaborate)
When i will finish to set up all of my stuff i will be happy to create an example project