britztopher britztopher - 1 year ago 230
Node.js Question

400 from Eureka js client with Amazon

For some reason Im getting a 400 back when registering with a Eureka on Amazon. At first I thought it had to do with the known issue with eureka js client, however, after apply the fixes for that issue it works locally, but not when datacenter object is Amazon. It seems to fetch the metadata from amazon, applies it to the eureka-js-client config object using local, then make the POST request, but it seems to respond with 400 status.

Here is my config object:

instance: {
app: 'my-node-service',
port: {
'$': 8201,
'@enabled': true
vipAddress: '',
statusPageUrl: 'http://__HOST__:8201/info',
dataCenterInfo: {
'@class': '$DefaultDataCenterInfo',
name: 'Amazon',
eureka: {
useLocalMetadata: true,
ssl: true,
// eureka server host / port
serviceUrls: {
default: [
servicePath: '/eureka/apps/'

which results in this ouput from EurekaClient.js file:

Error: eureka registration FAILED: status: 400 body: [object Object]
at /usr/app/node_modules/eureka-js-client/lib/EurekaClient.js:267:23
at Request.self.callback (/usr/app/node_modules/request/request.js:186:22)
at /usr/app/node_modules/async/dist/async.js:484:16
at nextTask (/usr/app/node_modules/async/dist/async.js:5195:29)
at /usr/app/node_modules/async/dist/async.js:5202:13
at apply (/usr/app/node_modules/async/dist/async.js:41:25)
at /usr/app/node_modules/async/dist/async.js:76:12
at /usr/app/node_modules/async/dist/async.js:988:16
at Request._callback (/usr/app/node_modules/eureka-js-client/lib/EurekaClient.js:570:9)
at /usr/app/node_modules/eureka-js-client/lib/EurekaClient.js:592:7

Any reason why this would occur. The examples that use
dont use default service Urls but this works locally when I use

Answer Source

Answered this in the GitHub issue as well, but putting it here for posterity =).

For Amazon datacenters (and the newer eureka JSON format), I think you'll need to pass a different value for @class. Try using:

If you still get a bad request, sometimes it helps to make the request manually to the service (since that's all this client does), if you have Postman or a similar tool, that would work. You can also set NODE_DEBUG=request to see what's happening at the request level in the client.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download