NodeJS Application unable to access from Zuul API Gateway - node.js

I created a Node.js (Using ExpressJS) microservice and registered it with Eureka Discovery Server using eureka-js-client.
I already have some Java based microservices registered with Eureka and using it through Zuul API Gateway.
When I try to invoke a specific endpoint on my Node.js micro-service via API Gateway, it throws an error:
Caused by: com.netflix.client.ClientException: Load balancer does not
have available server for client: tryout
Note: tryout is the name of my demo service application.

i had the same issue setting vipAddress same as the app name
vipAddress: your_app_name
in the eureka client config solved it.

Related

I have three microservices which are made in node Now I want to make a one apigateway for these services using nest js with kafka

How to connect these three microservices to api gateway. And this API gateway must be in nestjs with kafka server. So how can i connect apigateway and microservices.
I am not getting how to connect this services which are made in node and api gateway in nest.
The services are:
1-ms-authentication
2-ms-notification
3-ms-application
There is one API gateway which is nest-kafka-api-gateway.
Is it possible to connect api gateway in nest and this applications are in node??
I think you can use Nestjs "Hybrid application" as gateway. NestJS Hybrid application

Optionaly use eureka or kube services for nodeJS application depending on the environment

I have a nodeJS application running as a microservice and there are two scenarios:
when a developer is doing development on his machine. nodeJS application should register to eureka service and be able to communicate with other microservices without specifying URL or port to those services
when nodeJS application is deployed to kubernetes cluster, it should not register to Eureka and instead use existing kubernetes Services within the cluster to communicate with other services, again without specifying URL or port, only kubernetes service name
I was thinking of maybe using some env var that will tell the nodeJS service how to behave depending on the environment it is being started in

Creating API gateway using loopback4

How can I call my loopback4 api from another LB4 application?
Let me explain more,
I have created one lb4 application as microservice. I want to create gateway & want to call this lb4 microservice in lb4 gateway application . So for this, I have given target URL. As my microservice application runs on 3000 port & my gateway application runs on 8000 port.
Now I want to access all 3000 api endpoints with 8000 port that is by using gateway application. I have referred this for gateway creation https://loopback.io/doc/en/lb4/Integrating-with-api-connect.html. But it's not working.
Then, i tried to call rest api using openapi specification. I have followed Loopback4 - Call REST API with OpenAPI definition this link. All the endpoints are created in explorer but I am getting error as 'Not Implemented' after clicking on any api for getting response.
I hope I will get the solution here from experts!
Not sure how you are creating your gateway but does your gateway support patterns for example routes through Zuul can be configured with path: /myusers/myservice/** that means path starting with myusers/myservice and any path after this will be configured to routed to a service.Take a look at the following page for an example :-
https://cloud.spring.io/spring-cloud-netflix/multi/multi__router_and_filter_zuul.html

AWS API Gateway Locally

I'm trying to build an api gateway for an app in development using aws. I followed the steps in the doc https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-api-step-by-step.html.
However when I set my endpoint to be 127.0.0.1:3000/users for example, it returns an 500 {"message": "Internal server error"}.
The app is a simple nodejs endpoint run in docker. I'm just trying to discover api gateways.
I'm guessing the error is that the endpoint that I provide is not valid because I'm using it locally. So is there a way to use aws api gateway locally and is it the best option for an api gateway.
The doc you mention doesn't describe any method for deploying and running an api gateway locally, nor am I aware of any method to do this. I'm only aware of running API Gateway in AWS. The problem may be that you are trying to hit an API Gateway endpoint on your local machine, which is not possible.
Perhaps I misunderstand and you're trying to integrate an API Gateway in AWS with a service running locally. If this is the case, API Gateway will not be able to have an integration endpoint on your local machine, unless you expose your machine to the public internet AND provide api gateway with a public internet address for your machine. 127.0.0.1 is not a public internet address.

Connect nodeJs app to on-premise server using Secure Gateway

I'm trying to connect from a nodejs webapp to a REST api hosted on premise. I bounded a Secure Gateway instance and created a destination on port 80 to the machine where the SG client for RHEL 6 is running.
The request is still throwing a Timeout exception.
Do I have to modify the nodejs application code in any way or the SG should allow me to access the REST api transparently?
Your Node.js app needs to talk to the Secure Gateway service and not the API directly. Where you establish a connection to your on-premise API, replace the host name and port number with the cloud host name and port number that you were given when you created the destination.
There is an npm module to help your app obtain that host name and port - https://www.npmjs.com/package/bluemix-secure-gateway
And an example - https://www.ibm.com/blogs/bluemix/2015/04/reaching-enterprise-backend-bluemix-secure-gateway-via-sdk-api/

Resources