Error: glx.serveApp(app) expects a node/express app in the format `function (req, res) { ... } #53
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hey,
I am trying to convert an existing express app to use greenlock instead of AWS ALB + CertManager. I was able to go through the quickstart successfully but when I try to mount my existing app I get this error:
This is on express
4.17.1
.The express app is fairly complex with routers and custom middleware but nothing "hacky". It is written in typescript so maybe that is an issue?
The greenlock server code is basically the same as in the quickstart
I cannot post the full server code here, if there is anything in particular that I need to check I can do that. Overall I am not sure how a working express app wouldn't conform to what greenlock expects.
You're not doing what you think you're doing - which is why it's telling you.
Try editing this part:
If you're not using JavaScript you may have to run babel or some such. My understanding is that
.mjs
/ ES20xx doesn't play well with actual JavaScript.Thanks for the quick response!
I assume you meant
.serve
instead of.serveApp
?.serveApp
throws a "is not a function error".I tried wrapping the app object and the server starts up successfully but am getting this error when the service is called:
I added some logging
So the app object isn't a function, I don't have enough experience with express to know if this is odd? Setting up the server we don't do anything fancy.
and the a bunch of
app.get()
andapp.use()
to configure routes, middleware and child routers andmodule.exports = app;
at the end.But yea maybe you are right, only running the typescript compiler might not be enough and we need to transpile more.
Figured it out, the problem was with the export/import structure. The file that includes
module.exports = app
also included another export. Usingrequire
imported an object with both variables. Changing that made it work!