SteeltoeOSS / Steeltoe

.NET Components for Externalized Configuration, Database Connectors, Service Discovery, Logging and Distributed Tracing, Application Management, Security, and more.
https://steeltoe.io
Apache License 2.0
1.01k stars 163 forks source link

Port information is not transferred as part of body request #1298

Closed thompson-tomo closed 5 months ago

thompson-tomo commented 5 months ago

Describe the bug

When a eureka registration is occurring the port number is not being set in the payload however the

Steps to reproduce

Steps to reproduce the behavior:

  1. Define your port information in configuration
    Data.Add("eureka:instance:Port", "90");
    Data.Add("eureka:instance:NonSecurePortEnabled", true.ToString());
    Data.Add("eureka:instance:SecurePortEnabled", false.ToString());
  2. Have an application perform a registration with eureka
  3. Observe payload coming in
  4. Notice port numbers are not set
  5. Observe all other urls are using the port ie info & health address

Expected behavior

The port number number when configured is provided as part of the payload

Environment (please complete the following information):

bart-vmware commented 5 months ago

I'm unable to reproduce this with the provided details. Can you try with the FortuneTeller sample at https://github.com/SteeltoeOSS/Samples/blob/main/Discovery/src/FortuneTeller.sln?

thompson-tomo commented 5 months ago

Sure will look at that sample tomorrow my time & report back.

thompson-tomo commented 5 months ago

so i have noticed a couple of things while debugging. The IsUnsecurePortEnabled flag is not being respected for some reason and always showing as false even when config is different. I have tried using the property: IsUnsecurePortEnabled and what the docs stated but it hasn't helped. I have pushed my reproduct6ion up to my eureka branch of the samples

bart-vmware commented 5 months ago

The configuration key is named NonSecurePortEnabled, not IsUnsecurePortEnabled (see https://docs.steeltoe.io/api/v3/discovery/netflix-eureka.html).

thompson-tomo commented 5 months ago

found the root cause. I was using newtonsoft for my deserialisation rather than system.text.json hence it didn't respect the JsonPropertyName attributes. Hence closing