Giter Club home page Giter Club logo

vapors3signer's Issues

X-Amz-Credential parameter; the region 'eu-west-1' is wrong; expecting 'eu-west-2'

Hello,

Thank you for writing this Vapor provider. However, I am getting the above error for my request.

X-Amz-Credential parameter; the region 'eu-west-1' is wrong; expecting 'eu-west-2'

However, the Region object doesn't have an enum value for this, so I can't set the right config.

I could well be doing something wrong!

Phil

Accessing s3Signer, throws an error every time...

... even without payload.

v1.post("employeeImage", ":id") { req in
            guard let objectid = req.parameters["id"]?.string else {
                throw Abort.badRequest
            }

            let urlString = "https://" + Region.euCentral1.host.appending("yapa/\(objectid)")
            print(req.formData?["image"]?.part.body)
            guard let payload = req.body.bytes,
                let headers = try self.drop.s3Signer?.authHeaderV4(
                    httpMethod: .put,
                    urlString: urlString,
                    payload: Payload.bytes(payload)) else { throw Abort.serverError }
            
            let vaporHeaders = headers.vaporHeaders
            
            let resp = try self.drop.client.put(
                urlString, query: [:], vaporHeaders,
                Body(payload))
            
            return resp
        }

There were headers present in the request which were not signed

Hi, thanks for your work on this package.

I am trying to fetch a presigned URL from S3 for a bucket of mine. However, when I use the package and send the request, I am getting this message: "There were headers present in the request which were not signed".

Any idea? Here is the code.

guard let presignedURL = try drop.s3Signer?.presignedURLV4(httpMethod: .get, urlString: "https://s3.amazonaws.com/ecoroundgg/testUploadImage.png", expiration: TimeFromNow.thirtyMinutes, headers: [:]), let url = URL(string: presignedURL.urlString) else { throw Abort.serverError }
    
    _ = URLRequest(url:url)
    var headerToSend = [HeaderKey:String]()
    for header in presignedURL.headers{
      headerToSend[HeaderKey(header.key)] = header.value
    }
    print(headerToSend)
    let res = try drop.client.get(url.absoluteString, headers:headerToSend)
    print(res)
    return res
  }

Make uploaded file publicly accessible by setting ACL=public

File upload works just perfect, but whenever I try to download file from iOS client I'm getting AccessDenied. Somebody told me that there should be ACL => 'public' key-value set somewhere in request body, so S3 will know that this file should be accessible without authentication.
Please tell me how can I add additional parameters for uploaded file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.