0
Client: {
  transitional: {
    silentJSONParsing: true,
    forcedJSONParsing: true,
    clarifyTimeoutError: false
  },
  adapter: [Function: httpAdapter],
  transformRequest: [ [Function: transformRequest] ],
  transformResponse: [ [Function: transformResponse] ],
  timeout: 30000,
  xsrfCookieName: 'XSRF-TOKEN',
  xsrfHeaderName: 'X-XSRF-TOKEN',
  maxContentLength: -1,
  maxBodyLength: -1,
  validateStatus: [Function: validateStatus],
  headers: {
    common: { Accept: 'application/json, text/plain, */*' },
    delete: {},
    get: {},
    head: {},
    post: { 'Content-Type': 'application/x-www-form-urlencoded' },
    put: { 'Content-Type': 'application/x-www-form-urlencoded' },
    patch: { 'Content-Type': 'application/x-www-form-urlencoded' }
  },
  baseURL: 'http://localhost:3000/'
}
[Nest] 36736   - 23/08/2023, 09:54:39   [KeycloakStrategy] Invalid token message=connect ECONNREFUSED 127.0.0.1:80 +4124ms
[Nest] 36736   - 23/08/2023, 09:54:44   [KeycloakStrategy] Invalid token message=connect ECONNREFUSED 127.0.0.1:80 +5029ms
[Nest] 36736   - 23/08/2023, 09:55:10   [KeycloakStrategy] Invalid token message=connect ECONNREFUSED 127.0.0.1:80 +25666ms

I'm currently using NextJS with NestJS on the backend along with Keycloak. As you can see, in the console output showed above, I'm outputing the axios client with the visible baseURL and bellow there's an error for 127.0.0.1 on port 80, the problem is that I am not even making a request that port since the server is on port 3000.

This is how my axios instance is defined, previously on the baseURL there was "/" but I changed it to localhost:3000 to see if something would change, apparently the same EECONNREFUSED error kept showing.

export const client: AxiosInstance = axios.create({
  baseURL: "http://localhost:3000/",
  timeout: API_DEFAULT_TIMEOUT,
});

As for Keycloak, It's hosted on an EKS cluster with one replica deployment and a load balancer exposing the service. If you need more details about the cluster be free to ask.

I currently have no clue of where to start in order to solve this problem, even if you don't know how to solve this, atleast try to tell me where should I start.

0 Answers0