Skip to content
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

POST Timeout #872

Closed
2 tasks done
tapz opened this issue Feb 6, 2023 · 2 comments
Closed
2 tasks done

POST Timeout #872

tapz opened this issue Feb 6, 2023 · 2 comments

Comments

@tapz
Copy link

tapz commented Feb 6, 2023

Checks

Describe the bug (be clear and concise)

The same url works with curl, but not with http-proxy-middleware. The Express is running in Heroku. CURL in my local mac (also tested with an Android app). Based on the target logs in AWS CloudWatch logs for the lambda function, the proxied request never reaches the destination.

curl -X POST https://mytarget.com/api/v1/a/b

Feb 6 23:57:11  [HPM] Router new target: https://mytarget.com -> "https://mytarget.com"
Feb 6 23:57:11  [HPM] POST /api/v1/a/b -> https://mytarget.com
Feb 6 23:57:38  [ERROR] <SB691916D483> 	HTTP failed: Response timeout 
Feb 6 23:57:38  [ERROR] <SB691916D483> 	Stack: ServiceUnavailableError: Response timeout
Feb 6 23:57:38      at IncomingMessage.<anonymous> (/app/node_modules/connect-timeout/index.js:84:8)
Feb 6 23:57:38      at IncomingMessage.emit (node:events:513:28)
Feb 6 23:57:38      at Timeout._onTimeout (/app/node_modules/connect-timeout/index.js:49:11)
Feb 6 23:57:38      at listOnTimeout (node:internal/timers:559:17)
Feb 6 23:57:38      at processTimers (node:internal/timers:502:7)

Step-by-step reproduction instructions

1. Call the api
2. Timeout

Expected behavior (be clear and concise)

No timeout

How is http-proxy-middleware used in your project?

=> Found "[email protected]"
info Has been hoisted to "http-proxy-middleware"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "184KB"
info Disk size with unique dependencies: "596KB"
info Disk size with transitive dependencies: "4.66MB"
info Number of shared dependencies: 10

What http-proxy-middleware configuration are you using?

router.use(
    '/api/v1',
    createProxyMiddleware({
      target: 'https://mytarget.com',
      router: () => 'https://mytarget.com',
      changeOrigin: true,
      logLevel: 'debug',
      logProvider: () => {
        return {
          log: console.log,
          debug: console.info,
          info: console.info,
          warn: console.warn,
          error: console.error,
        };
      },
    })
  );


### What OS/version and node/version are you seeing the problem?

```shell
Heroku (AWS)
Ubuntu 20.04
Node 18.13.0 (also tested with 16.x.x)

Additional context (optional)

No response

@chimurai
Copy link
Owner

chimurai commented Feb 6, 2023

Not clear from your example...
I suspect you are also using the body-parser middleware.
If so, try to configure body-parser after http-proxy-middleware

@tapz tapz closed this as completed Feb 7, 2023
@chimurai
Copy link
Owner

chimurai commented Feb 8, 2023

dupe of #40 (comment)

@chimurai chimurai changed the title Timeout POST Timeout Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants