Skip to content

servicediscovery compatability issue with localstack #2556

Closed
@codefromthecrypt

Description

Acknowledgements

Describe the bug

DiscoverInstances prefixes "data-" to the hostname, rendering localhost (specifically localstack) tests useless, as the hostname "data-localhost" doesn't exist.

Expected Behavior

I would like to use all servicediscovery functions. I'm not sure why others work and DiscoverInstances specifically does this

Current Behavior

I end up with an error like this:

2024-03-14T12:39:51.350703Z	error	unable to refresh Cloud Map cache due to error, using existing cache: error retrieving instance list from Cloud Map for "1" in "testns": operation error ServiceDiscovery: DiscoverInstances, https response error StatusCode: 0, RequestID: , request send failed, Post "http://data-localhost:32957/": dial tcp: lookup data-localhost: no such host

Reproduction Steps

localstack requires an authenticated docker image (localstack-pro) to run, so probably reproduction won't help as much, but the command that fails looks like this:

	instOutput, err := client.DiscoverInstances(ctx, &servicediscovery.DiscoverInstancesInput{ServiceName: svc.Name, NamespaceName: ns.Name})
	if err != nil {
		return nil, errors.Wrapf(err, "error retrieving instance list from Cloud Map for %q in %q", *svc.Name, *ns.Name)
	}

Possible Solution

maybe there is a way to avoid this part of the stack. I don't mind a workaround for testing.

Additional Information/Context

where the prefix happens: https://github.com/aws/aws-sdk-go-v2/blob/main/service/servicediscovery/api_op_DiscoverInstances.go#L193

AWS Go SDK V2 Module Versions Used

	github.com/aws/aws-sdk-go-v2 v1.25.3
	github.com/aws/aws-sdk-go-v2/config v1.27.7
	github.com/aws/aws-sdk-go-v2/credentials v1.17.7
	github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.29.2

Compiler and Version used

go version go1.22.1 darwin/arm64

Operating System and version

macOS 14.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions