question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Zuul Load balancer does not have available server for client

See original GitHub issue

I’ve been trying to connect microservices using Zuul and Eureka and have succeeded for the most part except re-routing through Zuul based on serviceId. What I have is Spring Boot Zuul and Eureka applications, and a Node-based microservice which registers with Eureka. Both Zuul and the microservice are registered with Eureka and show up on the Eureka control panel, however, when I try to route through Zuul to the microservice I get the following exception:

com.netflix.zuul.exception.ZuulException: Forwarding error
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: steam-auth-service

Routing through IP seems to work, but I don’t need that.

Zuul application.properties:

server.port=8079
eureka.client.service-url.defaultZone=http://localhost:8088/eureka
zuul.routes.steam-auth-service.serviceId=steam-auth-service
zuul.routes.steam-auth-service.path=/steam/**

Node.JS Eureka client registration:

// Discovery service info
const eurekaServer = {
  host: process.env.EUREKA_HOST,
  port: process.env.EUREKA_PORT,
  servicePath: '/eureka/apps/',
};

// Client to connect to Eureka discovery service
const eurekaClient = new Eureka({
  instance: {
    app: 'steam-auth-service',
    hostName: 'localhost',
    ipAddr: '127.0.0.1',
    port: {
      $: process.env.PORT,
      '@enabled': true,
    },
    vipAddress: 'steamauth.pubgtrade.com',
    dataCenterInfo: {
      '@class': 'com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo',
      name: 'MyOwn',
    },
  },
  eureka: eurekaServer,
});

As I said, both the Zuul application and the microservices are registered with Eureka and show up in the control panel.

/eureka/apps response:

<applications>
<versions__delta>1</versions__delta>
<apps__hashcode>UP_2_</apps__hashcode>
<application>
<name>STEAM-AUTH-SERVICE</name>
<instance>
<hostName>localhost</hostName>
<app>STEAM-AUTH-SERVICE</app>
<ipAddr>127.0.0.1</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">3001</port>
<securePort enabled="false">7002</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1514334766260</registrationTimestamp>
<lastRenewalTimestamp>1514334886300</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1514333831189</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<vipAddress>steamauth.pubgtrade.com</vipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1514334766260</lastUpdatedTimestamp>
<lastDirtyTimestamp>1514334766260</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
<application>
<name>PUBG-API-GATEWAY</name>
<instance>
<instanceId>192.168.0.13:pubg-api-gateway:8079</instanceId>
<hostName>192.168.0.13</hostName>
<app>PUBG-API-GATEWAY</app>
<ipAddr>192.168.0.13</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8079</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1514334380413</registrationTimestamp>
<lastRenewalTimestamp>1514334890454</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1514334380413</serviceUpTimestamp>
</leaseInfo>
<metadata>
<management.port>8079</management.port>
<jmx.port>36983</jmx.port>
</metadata>
<homePageUrl>http://192.168.0.13:8079/</homePageUrl>
<statusPageUrl>http://192.168.0.13:8079/info</statusPageUrl>
<healthCheckUrl>http://192.168.0.13:8079/health</healthCheckUrl>
<vipAddress>pubg-api-gateway</vipAddress>
<secureVipAddress>pubg-api-gateway</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1514334380413</lastUpdatedTimestamp>
<lastDirtyTimestamp>1514334380381</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
</applications>

I looked through closed issues with the same title but they had some sort of code missing which is present in my applications. Again, both Zuul and my microservice show up in the Eureka control panel, and I can get Zuul’s address in my microservice. Zuul, however, fails to recognize when trying to route through serviceId. Any tips?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
famargoncommented, Feb 15, 2018

Solved!! I was wrong, it’s not a problem between eureka-js-client and ribbon, its just a service with not te correct configuration. An instanceId and a vipAddress is needed

const eureka = new Eureka({
  instance: {
    id: 'node-simple-service',    
    instanceId: 'node-simple-service',
    app: 'node-simple-service',
    hostName: 'localhost',
    ipAddr: '127.0.0.1',
    statusPageUrl: 'http://localhost:8200',
    port: {
      '$': SERVER_PORT,
      '@enabled': 'true',
    },
    vipAddress: 'node-simple-service',
    dataCenterInfo: {
      '@class': 'com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo',
      name: 'MyOwn',
    }
  },
  eureka: {
    host: 'localhost',
    port: 8761,
    servicePath: '/eureka/apps/'
  }
});
0reactions
spencergibbcommented, Feb 13, 2018

We don’t maintain eureka-js-client

Read more comments on GitHub >

github_iconTop Results From Across the Web

Load balancer does not have available server for client
Adding @EnableEurekaClient solved this issue. The Zuul application is now discoverable in the Eureka server and is able to route requests.
Read more >
"Load balancer does not have available server for client". Is ...
I use spring-boot + eureka + zuul, spring.cloud.version: 2.0.2. ... "Load balancer does not have available server for client".
Read more >
Load balancer does not have available server for client:XXX
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: shop-user
Read more >
Spring Cloud discussion and questions - Gitter
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: iam-service at com.netflix.loadbalancer.
Read more >
[Solved]-Load balancer does not have available server for client
Short answer. ribbon: eureka: enabled: false. Spring Cloud Netflix Zuul uses Netflix's Ribbon to perform client-side load balancing, and by default, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found