justinm1 / vapors3signer Goto Github PK
View Code? Open in Web Editor NEWVapor Provider for S3SignerAWS - generate V4 headers/pre-signed URLs for S3 REST API requests
License: MIT License
Vapor Provider for S3SignerAWS - generate V4 headers/pre-signed URLs for S3 REST API requests
License: MIT License
I receive that error when i trying use Put Method, and I can't send file.
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
... 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
}
The version number of the latest release should be 3.0.2, not v3.0.2
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
}
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.