-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 Get Signed URL accepts callback but not promise #1008
Comments
@binoculars I agree that we should also allow for We'll definitely be looking into ways to make using promises easier in the next major version bump. |
🆒 I've been very happy with v2.3 and promise support especially since Lambda updated to Node 4.3.2. Thanks for the quick reply! |
+1 for this, would be nice (whether it 'needs' a promise or not) to have a standard way of handling all calls. Saves doing something like; var p = new Promise(function(resolve,reject) {
S3.getSignedURL('getObject', params, function(err, url) { resolve(url); });
}); |
Commenting to note my suggestion from another thread, as a bluebird user I've been using
I think the sometimes-synchronous interface should be deprecated in favour of returning a |
@Dayjo you want to make sure you reject with errors as well. new Promise((resolve, reject) => {
s3.getSignedUrl('getObject', opts, (err, url) => {
if (err) reject(err)
else resolve(url)
})
}) |
@jsonmaur indeed, 'twas but an example 👍 |
Would love to see this as well. |
I'd be willing to do this and open a PR but I'd appreciate design approval from a maintainer before I go ahead since this will require an API change. Current:
So maintainers, what do you think about adding? |
@IsaiahJTurner Adding a separate |
+1 for @IsaiahJTurner's proposal, just wrote an internal implementation and that signature is very intuitive as an end user that's familiar with working in Promises + async/await. const getSignedUrlPromise = (operation, params) =>
new Promise((resolve, reject) => {
s3.getSignedUrl(operation, params, (err, url) => {
err ? reject(err) : resolve(url);
});
}); Basic usage const url = await getSignedUrlPromise('putObject', {
Bucket: 'my-bucket',
ContentType: ...,
Key: ...,
}).catch((err) => console.error(err)); |
Any update on this? I could also use this. |
This is something we're reviewing for the next major version bump. Appreciate you chiming in with your feedback. |
Guys -- I appreciate the "major version bump" but you do know it's been 2+ YEARS waiting here.. ?? |
Just stumbled on this after 1 hour of debugging. Exceptions to the normal .promise() behavior should be made clear somewhere in the documentation |
me too 😞 |
How many years does it take... I just had to implement this on my own. My Lambda method was returning 502s with just the callbacks. |
This would be a really helpful feature and would save a lot of trouble! |
A major version is required for breaking changes indeed, yet aws-sdk-js already has a config concept, thus API changes could be handled smoothly without breaking changes. Those that want I'll stay positive and say that the AWS team must have a strong reason for not doing this, because flags is what everyone uses naturally when versioning (version bumping) is not an option. |
Andrei, We've started work on a solution that's modeled after the AWS.Credentials pattern, and plan to release it soon. As discussed above, adding promise support to the JavaScript V2 SDK in a generic way is a breaking change, but we can build a solution for key APIs such as these additively while keeping the interface consistent across the SDK. Concerns such as these prompted us to design and build the JavaScript V3 SDK such that it provides a promise-based API out-of-the-box, including one for presigned URLs . It's also modular, so you can load just the S3 Presigner package if that's all you need, and side-load along with the V2 SDK to gracefully migrate over. It's already available in Developer Preview, if that works for your use case, and we're working hard at getting it to GA. Thanks again for your feedback. We are trying to get better at responding to issues, so please continue to +1 issues and provide feedback via Github. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
I'm trying to get away from the callback pattern and go with the promise pattern since Async functions will rely on promises in esnext. If it's actually synchronous, why provide a callback option? If callback is required, shouldn't promise be an option?
The text was updated successfully, but these errors were encountered: