I am setting up a client in nodeJS with eureka using zuul for routing management
Here I have a test of a service with express and the configuration of eureka nodejs link running on the Port 3001
const Eureka = require('eureka-js-client').Eureka;
const express = require('express');
const server = express();
server.use(express.json());
server.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
server.listen(3001);
server.get('/demo3', function (req, res) {
res.send("CIaooo");
});
// example configuration
const client = new Eureka({
// application instance information
instance: {
app: 'MS3',
instanceId: 'MS3',
hostName: 'localhost',
ipAddr: '127.0.0.1',
port: {
'$': 3001,
'@enabled': 'true',
},
vipAddress: 'jq.test.something.com',
statusPageUrl: 'http://localhost:3001/demo3',
dataCenterInfo: {
'@class': 'com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo',
name: 'MyOwn',
},
registerWithEureka: true,
fetchRegistry: true
},
eureka: {
// eureka server host / port
host: 'localhost',
port: 8761,
servicePath: '/eureka/apps/'
},
});
client.logger.level('debug');
client.start(function(error){
console.log(error || 'complete')});
Here the configuration of the Zuul as an application.yml file with the service called demo3 (demo2 and demo1 work perfectly when the microservice is done in Spring), only the problem is with an application put in NodeJS
zuul:
routes:
demo3:
path: /demo3/**
serviceId: MS3 # registramos al microservicio
stripPrefix: false
# Discovery Server Access
eureka:
client:
registerWithEureka: false
serviceUrl:
defaultZone: http://localhost:8761/eureka/
server:
port: 8080 # HTTP (Tomcat) port
The application.yml of eureka is:
server:
port: 8761
eureka:
client:
registerWithEureka: false
fetchRegistry: false
And the ports are: Application Zuul: 8080 Eureka Server: 8761 Demo3: 3001
and the error is: Whitelabel Error Page This application has no explicit mapping for / error, so you are seeing this as a fallback.
Wed Dec 26 13:49:16 COT 2018 There was an unexpected error (type = Internal Server Error, status = 500). GENERAL com.netflix.zuul.exception.ZuulException: Forwarding error at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.handleException (RibbonRoutingFilter.java:191) at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward (RibbonRoutingFilter.java:166) at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run (RibbonRoutingFilter.java:114) at com.netflix.zuul.ZuulFilter.runFilter (ZuulFilter.java:117) at com.netflix.zuul.FilterProcessor.processZuulFilter (FilterProcessor.java:193) ... Load balancer does not have server for client: MS3 ... at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward (RibbonRoutingFilter.java:161) ... 64 more