#ENOTFOUND connecting to my microservice deployed on render.com

1 messages · Page 1 of 1 (latest)

vagrant stag
#

I have a NestJS backend which calls out to a NestJS microservice. The provider looks like this:

const microserviceProvider = {
  provide: SERVICE_NAME,
  useFactory: () => {
    return ClientProxyFactory.create({
      transport: Transport.TCP,
      options: {
        host: 'http://my-microservice-name-here.onrender.com',
        port: 8080,
      },
    });
  },
};

In development this works fine - I use 0.0.0.0 at the host. When I deploy them to render.com, this code throws an ENOTFOUND error:

[Nest] 24050  - 02/12/2023, 6:26:34 PM   ERROR [ClientTCP] Error: getaddrinfo ENOTFOUND https://my-application-name-here.onrender.com:8080

Does anyone have advice for what I should be doing differently? I am able to set up other NestJS services fine (frontends, backends) - but this is my first time trying to deploy a microservice.

Thanks for any help!

mystic gorge
vagrant stag
#

omg that worked. thank you!!

vagrant stag
#

@mystic gorge do you know what i put for the host on the microservice side? i've tried 0.0.0.0 and the same hostname. in the first case the caller gets a "connection closed", in the second case the microservice gets a Error: listen EADDRNOTAVAIL: address not available IP_HERE:8080

mystic gorge
#

it depends on how you're deploying the app and what are the network configurations

vagrant stag
#

yeah - sorry if i was unclear. i have a nestjs app calling another nestjs app - the first is a standard webserver and the second is a microservice. i see...

mystic gorge
#

are you sure the onrender.com provider allows you to listen on port 8080?

vagrant stag
#

i'm not, it might actually be exposing 10000. i'm gonna try that. appreciate your tips a million

mystic gorge
# vagrant stag i'm not, it might actually be exposing 10000. i'm gonna try that. appreciate you...

I guess this is what you're looking for
https://render.com/docs/private-services

when you deploy the server-side microservice application, it should listen on 0.0.0.0 on port 10000
inside the render.yaml, you can mark a service as private by setting type: pserv
https://render.com/docs/blueprint-spec#services

also, don't forget to provide the env port in the render.yaml file

- type: pserv
  name: nestjs-service
  envVars:
  - key: PORT
    value: 10000

( I have never used that provider before, and I just read their documentation )

vagrant stag
#

you were spot on. that was it! thanks so much for all your help

#

you are awesome