Netlify-lambda serve infinite loop

Hi all,

I’m finally connecting all the dots and slowly getting closer to being able to run my lambda on Netlify, but I’m stuck in an infinite loop when running netlify-lamda serve.

netlify.toml:

[build]
  functions = "lambda"
  publish = "build"

package.json:

"scripts": {
    "start": "run-p start:**",
    "start:app": "react-scripts start",
    "start:lambda": "netlify-lambda serve src/lambda --config webpack.functions.js",
    "build": "run-p build:**",
    "build:app": "react-scripts build",
    "build:lambda": "netlify-lambda build src/lambda --config webpack.functions.js",
  },

When I run the start:lambda command:

(╯°□°)╯︵ ┻━┻ offroad-members (typescript-prisma-1) $ NODE_ENV=development npm run start:lambda

> frontend-cra@0.1.0 start:lambda /Users/xxxx/offroad-members
> netlify-lambda serve src/lambda --config webpack.functions.js

netlify-lambda: Starting server
Hash: 14b1a40dc71dce4c4666
Version: webpack 4.42.0
Time: 1114ms
Built at: 05/18/2020 8:37:04 AM
     Asset     Size   Chunks             Chunk Names
graphql.js  346 KiB  graphql  [emitted]  graphql
Entrypoint graphql = graphql.js
[./bundle/app.ts] 1.02 KiB {graphql} [built]
[./bundle/generated/index.ts] 2.03 KiB {graphql} [built]
[./bundle/generated/prisma-schema.ts] 216 KiB {graphql} [built]
[./bundle/resolvers/Ballot.ts] 1.2 KiB {graphql} [built]
[./bundle/resolvers/index.ts] 305 bytes {graphql} [built]
[./bundle/server.ts] 1.51 KiB {graphql} [built]
[./bundle/typeDefs.ts] 11.8 KiB {graphql} [built]
[./graphql.ts] 573 bytes {graphql} [built]
[apollo-server-express] external "apollo-server-express" 42 bytes {graphql} [built]
[cookie-parser] external "cookie-parser" 42 bytes {graphql} [built]
[cors] external "cors" 42 bytes {graphql} [built]
[dotenv] external "dotenv" 42 bytes {graphql} [built]
[express] external "express" 42 bytes {graphql} [built]
[jsonwebtoken] external "jsonwebtoken" 42 bytes {graphql} [built]
[serverless-http] external "serverless-http" 42 bytes {graphql} [built]
    + 15 hidden modules
Lambda server is listening on 9000
Request from ::1: POST /graphql
Response with status 200 in 954 ms.
Request from ::1: POST /graphql
Response with status 200 in 28 ms.
Request from ::1: POST /graphql
Response with status 200 in 26 ms.

Something is requesting the site and making it reload in an infinite loop.

Repo: GitHub - cfree/offroad-members at typescript-prisma-1

Any thoughts??

Hi @cfree, I cloned your repo and was not able to reproduce the issue. You might want to make sure you don’t have anything running in the background that is hitting localhost port 9000. Let me know if that helps.