Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression with using fake local GCS server #1680

Closed
vikstrous opened this issue Nov 25, 2019 · 5 comments
Closed

regression with using fake local GCS server #1680

vikstrous opened this issue Nov 25, 2019 · 5 comments
Assignees
Labels
api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue.

Comments

@vikstrous
Copy link

Client

Storage

Describe Your Environment

Local docker container running https://github.com/fsouza/fake-gcs-server, tests trying to connect to it with the GCS client in this repo.

Expected Behavior

Connects to the local server

Actual Behavior

Connects to https://storage.googleapis.com/storage/v1/ unconditionally and returns a 404 error

The regression was introduced by fc09f3a in https://github.com/googleapis/google-cloud-go/releases/tag/storage%2Fv1.3.0 (version 1.3.0)

@jeanbza jeanbza added the api: storage Issues related to the Cloud Storage API. label Nov 26, 2019
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Nov 26, 2019
@tritone
Copy link
Contributor

tritone commented Nov 26, 2019

Hi @vikstrous , thanks for the report. Can you show me how you are setting the endpoint when you have this issue? I took a look at your repo but it wasn't immediately obvious to me. Thanks!

@tritone tritone added status: investigating The issue is under investigation, which is determined to be non-trivial. and removed triage me I really want to be triaged. labels Nov 26, 2019
@vikstrous
Copy link
Author

Ah, actually, it looks like we had to do some hacks to set the endpoint. Our code looks something like this:

	addr := "127.0.0.1:4443"
	opt := option.WithHTTPClient(&http.Client{
		Transport: &http.Transport{
			DialTLS: func(string, string) (net.Conn, error) {
				return tls.Dial("tcp", addr, &tlsConfig)
			},
		},
	})
	client, err := storage.NewClient(ctx, opt)
	if err != nil {
		panic(err)
	}

@tritone
Copy link
Contributor

tritone commented Nov 26, 2019

Ah, that can be easily fixed on your end then. Just pass the following option into NewClient as well:

option.WithEndpoint(addr)

Let me know if that doesn't work on your end.

@tritone tritone added type: question Request for information or clarification. Not an issue. and removed status: investigating The issue is under investigation, which is determined to be non-trivial. labels Nov 26, 2019
@tritone tritone closed this as completed Nov 26, 2019
@vikstrous
Copy link
Author

WithEndpoint was the right hint, but I actually had to use option.WithEndpoint("https://www.googleapis.com/storage/v1/") to connect to my local fakegcs server. Any other value was not working as expected. I didn't dig far enough to understand exactly why.

@tritone
Copy link
Contributor

tritone commented Nov 27, 2019

Got it, thanks for following up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

5 participants