-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxying lambda requests with gatsby serve #12924
Comments
Was thinking that I might be able to use |
I was able to get things working by not using
With the following modifications to my
But would love to know if there's a built-in way that I can handle this without the additional dep. |
I don't think it's a bad idea to create a new API extension like |
@wardpeet That'd be pretty nice for sure! Less deps FTW 🎉 |
I'll write down a short description on how to fix it.
// Expose access to app for advanced use cases
const { serveMiddleware } = config
if (serveMiddleware) {
serveMiddleware(app)
}
|
@wardpeet can you assign me this issue? |
We'd love for your contribution @iFlameing 🎉 |
Just closed the pull request that @iFlameing opened after a discussion with the team. We'd like to keep We could perhaps unify express middleware APIs in v3 (and rename from Opened an issue for that in #13631 and closing this in the mean time |
@sidharthachatterjee Cool, no worries! Here's a blog post that goes into a bit more detail how I accomplished the workaround for anyone who needs this for the future. |
Hey all - it's been more than a year and we have a strong need to be able to hook into Gatsby's production express router. Would you be willing to take a PR to add a |
Description
developMiddleware
is lost in CLIserve
command for Netlify Lambda functions.Steps to reproduce
Using
netlify-lambda
and the following rewrite for local access withingatsby-config.js
, requests are getting through just fine when developing (from the tutorial):However, when I want to use
gatsby serve
, even when attempting to run things like so, the path rewrites are not happening (but are still available on port 9000):Overriding port here to not conflict with lambda server. Any thoughts on how we can expose the rewrite for the CLI
serve
command? Thanks!Expected result
Proxy API requests just as
gatsby develop
does.Actual result
The
:9000
endpoint is still available, but not respecting proxy. I do understand theserve
is not meant to run asdevelop
, but with the current config; it makes local build testing not work correctly.Environment
The text was updated successfully, but these errors were encountered: