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

S3 Presign URL: (MISSING) Values #894

Closed
krak3n opened this issue Oct 17, 2016 · 4 comments
Closed

S3 Presign URL: (MISSING) Values #894

krak3n opened this issue Oct 17, 2016 · 4 comments

Comments

@krak3n
Copy link

krak3n commented Oct 17, 2016

Hi

When attempting to generate a pre-signed s3 get object url the generated url contains (MISSING) values:

https://s3-eu-west-1.amazonaws.com/bucket.name/key?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ACCESS_KEY%!F(MISSING)20161017%!F(MISSING)eu-west-1%!F(MISSING)s3%!F(MISSING)aws4_request&X-Amz-Date=20161017T110116Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host%!B(MISSING)x-amz-content-sha256&X-Amz-Signature=SIGNATURE

How I'm calling it:

    svc := s3.New(session.New(&aws.Config{
        Region:           aws.String("eu-west-1"),
        Credentials: credentials.NewCredentials(&credentials.StaticProvider{
            Value: credentials.Value{
                AccessKeyID:     "my-access-key",
                SecretAccessKey: "my-secret-key",
            },
        }),
    }))
    req, out := svc.GetObjectRequest(&s3.GetObjectInput{
        Bucket: aws.String("bucket.name"),
        Key:    aws.String("key"),
    })
    urlStr, err := req.Presign(time.Second * 60)

I don't really know what I am doing wrong so any help would be much appreciated 😄

Thanks,

Chris

@krak3n
Copy link
Author

krak3n commented Oct 17, 2016

Meh ignore me, ended up being a problem with my out put of the URL.

@krak3n krak3n closed this as completed Oct 17, 2016
@keenan-v1
Copy link

Not to necro this 3 years later, but for those of us doing programming before our morning cups of coffee: don't Printf your URLs. :)

@perholmes
Copy link

I just stepped in the very same thing. I was outputting the URL using my Go logging, which is Printf based, and grabbing the URL from the log for testing, it was full of "!FMISSING" stuff. When I printed the URL using fmt.Println(url), everything is fine. Pure testing problem.

@perholmes
Copy link

Or to be clearer, don't print the url as the formatting string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants