-
Notifications
You must be signed in to change notification settings - Fork 443
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
node.js x react x Auth0 Error: connect ECONNREFUSED 127.0.0.1:80 when using docker-compose but not when using docker run #297
Comments
I am not sure I understand this. maybe the jwks uri? in the example you shared it say |
Hello, sorry for the very late answer I was under the water for a long time. |
Ok, I am not sure how to help. In the first message you stated that the error is:
This library in particular doesn't make ANY http request nor establish any tcp connection. In addition to that you mention that it works with certain configuration of docker, but this library doesn't have any specific code for docker itself. The JWKS library does make a request, it will help if you can check what value are you exactly getting in that environment variable. Are you sure you are specifying the Maybe introducing a |
Could you solve the problem? I'm facing that problem too |
I also faced the same issue. The problem was with environment variables in .env file. Changed the following, On the this line if the URL has two double quotes like this Due to the extra double quotes the request module is making the request on localhost:80 instead of the specified JWKS url. |
Description
I'm using a React front end (served by my node.js back end) to make secured requests to my express-jwt secured backend (see code samples below).
Everything worked fine in the development and tests phases (using node alone and simple docker runs).
But when I started using docker-compose to deploy my whole stack (I have redis,mongo and influx containers that need to interact with maximum security, easy and fast configuration customization hence the use of docker-compose) everything went wrong and I couldn't make any secured requests to my back end as it was trowing 500s!
It says it wants (but fails) to connect to "127.0.0.1:80", my web app (and its container) is running on port 8080 and I never call anything remotely similar to the localhost on port 80 anywhere (not in front end nor back end).
Expected behavior: Secure api request with valid token returns the datas to the authorized user as it does with node standalone and docker run.
Current behavior: With docker-compose access to front end and unprotected routes is possible and works great but access to express-jwt protected routes throws error (see log sample below).
Since the issue is appearing only for express-jwt routes I'm pretty sure the issue comes from this lib and/or one of its components.
Reproduction
The issue happens consistently every time I run my web container with docker-compose. but not when I run it with a simple docker run
Steps to reproduce:
Back end code sample
Dockerfile for web service
docker-compose web service description:
logs when trying to access secured endpoint:
Environment
"express-jwt": "^6.1.1"
Thank you all in advance for your precious help!
The text was updated successfully, but these errors were encountered: