-
Notifications
You must be signed in to change notification settings - Fork 581
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
AWS typescript SDK for deno typescript runtime. #1289
Comments
Attempted the following: According to https://www.reddit.com/r/Deno/comments/hcdtrx/deno_faq_for_this_subreddit/ Therefore tried this deno typescript source:
Unfortunately jspm doesn't implement node's http2 library:
|
Apparantly there is a tool https://www.npmjs.com/package/denoify to transform .ts sources. |
Working on this in https://github.com/PaulThompson/aws-sdk-js-v3/tree/master/deno |
Denoify was too generic for the task - particularly the fact that all the See https://github.com/PaulThompson/aws-sdk-js-v3/tree/master/deno Latest error on that is:
Which is unfortunately a deno missing API. |
The fetch-http-handler should work with Deno: I tried loading the EventBridge client via the pika.dev service to no avail: |
Deno support would be awesome for scripts that are easy to pass around without having to pass a whole project directory and without requiring colleagues to have deep knowledge of e.g., pip (Python), bundler (Ruby), npm/yarn, etc. |
It's not pretty but, for anyone who comes looking, I was able to piece together a request that seems to mostly* work:
* The Deno code above does seem to reach the right backend logic at AWS but the particular action I was trying to invoke is apparently not allowed by AWS. When I ran the code with expired credentials, I got the following response: |
deno FileReader API has been merged to master: denoland/deno#5249 🍾 I forked the work from @PaulThompson and added a few more fixes. We can now make some basic API requests: import { S3 } from 'https://raw.githubusercontent.com/christophgysin/aws-sdk-js-v3/deno/deno/client-s3/mod.ts'
const s3 = new S3({
region: Deno.env.get('AWS_REGION'),
credentials: {
accessKeyId: Deno.env.get('AWS_ACCESS_KEY_ID')!,
secretAccessKey: Deno.env.get('AWS_SECRET_ACCESS_KEY')!,
},
})
const { Buckets = [] } = await s3.listBuckets({})
Buckets.forEach(bucket => console.log(bucket.Name)) |
Thanks @christophgysin |
someone has been working on DynamoDB client https://github.com/chiefbiiko/dynamodb |
I noticed SecretsManager > listSecrets request params are missing 'Filter' param.
Technically, I'd love to help, but not sure where to start! |
@mrowles Could you open an issue on https://github.com/christophgysin/aws-sdk-js-v3/issues? Please provide a full example to reproduce the problem. |
@christophgysin Done, cheers - christophgysin#3 |
Straight question as the outcome of this thread is not clear ..... does the AWS JavaScript SDK fully support Deno? |
@bootrino No, it does not support deno at all. I maintain a fork that I try to keep in sync which supports deno, and is published on deno.land. |
That's a pity, anyone know if Amazon plans to officially support deno? Is posting in this thread making such a request, or does such a request need to be posted elsewhere? |
This is maintainer of AWS SDK for JavaScript. Tagging recent commenters @bootrino @christophgysin @mrowles Some ways this request can get prioritized is:
|
Thanks for the encouragement @trivikr and the work @christophgysin on https://github.com/christophgysin/aws-sdk-js-v3 https://deno.land/x/aws_sdk |
Update: The private Deno company was just announced https://deno.com/blog/the-deno-company
|
@trivikr As of time of writing, this issue has the highest number of 👍s by a fairly large margin: https://github.com/aws/aws-sdk-js-v3/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc Great work deno community! 🎉 I can't speak to how much progress has been made on the other points, but for my use case, Deno's number 1 advantage compared to node is its excellent support for HTTP2 out of the box with its native fetch for the client side and built-in http server APIs for the server side. From my limited research so far, the HTTP2 client situation in node is especially dire:
Many of the most widely used AWS services (dynamo, s3, lambda, etc) would benefit greatly from a wider availability of high-quality HTTP2-capable clients (fewer tcp connections -> lower latency for clients and lower load on servers). In fact, this library itself can significantly reduce its maintenance burden in the long term by relying on a robust native fetch implementation in deno over maintaining its own http2 client built on top of the low-level APIs provided by node (and hope node eventually catches up with a native fetch implementation of its own). |
Deno v1.25 now has experimental support for npm. If you test AWS SDK for JavaScript (v3) with Deno v1.25, do post your summary in this issue. |
It's just not ready yet, their node polyfill in Given the following script: import { S3 } from "npm:@aws-sdk/client-s3";
await new S3().listBuckets({}); Deno will fetch and cache all the node dependencies, and then throw this error in runtime:
|
After publishing this post, someone from Deno pointed me to aws-api.deno.dev, which turned out to provide the only DynamoDB client for Deno that worked for me right off the bat. Maybe worth considering as an alternative until we can use the official SDK. |
Thanks for the shoutout! My aws-api.deno.dev project is intended to serve as a minimal Deno-first API client for all of the various AWS services. It certainly lacks various higher-level routines, notably DynamoDB document helpers (as shown in the linked tweet) and S3 pre-signing. Anyway, aws-api.deno.dev should work for most API-invoking usecases, and I still use it extensively, |
in case it helps someone: got the following to work in the current Deno version: import { PutObjectCommand, S3Client } from "https://esm.sh/@aws-sdk/[email protected]"
// trying to load the credentials provider through esm.sh as well didn't work
import { fromSSO } from 'npm:@aws-sdk/credential-providers'
const s3 = new S3Client({ credentials, region: 'eu-central-1'})
await s3.send(new PutObjectCommand({
Bucket: "myBucket",
Key: '/my/key',
Body: 'Body'
})) The same works for the Lambda client. |
@skorfmann This did not work with aws-sdk |
Using
|
hi @christophgysin I tried to import_map
and then in my edge function
but I am getting this error:
|
hi can I ask you how did you find this esm .sh link? I want to know if there is a search engine where I can search for different esm modules somewhere? Also thanks allot for sharing it :) |
For the version you mean? |
Did you find a solution? |
Updates on my last comment. As of Deno 1.39.0, npm support already allows the use of AWS SDK. The following snippet already works. import { S3 } from "npm:@aws-sdk/client-s3";
await new S3({}).listBuckets({}); |
Hi everyone on the thread. Based on @vicary 's last comment I assume this is now the case, but I haven't actually looked into it. Because of those factors, I'm going to go ahead and close this issue. Since there is a lot of comments and upvotes on this thread, if anything is left unresolved, please feel free to create a separate issue so we can address it on a per-customer cadence. Thanks again, |
Understood, @RanVaknin. To note though, the AWS SDK does actually have separate support for node, browser and react-native (see all Over time deno has added support for importing npm modules as well as supporting more of node's own internal APIs to the point where it now works.
import { S3 } from "npm:@aws-sdk/client-s3";
import { SecretsManager } from "npm:@aws-sdk/client-secrets-manager";
console.log(
await new S3({
region:"ap-southeast-2"
}).listBuckets({}));
console.log(
await new SecretsManager({
region:"ap-southeast-2"
}).listSecrets({})); deno run --allow-sys --allow-env --allow-net --allow-read test.ts |
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. |
Is your feature request related to a problem? Please describe.
Typescript code generated to a file tree on github, in a manner that can be imported and used by deno.
So that users of deno can use the AWS typescript SDK in future.
Describe the solution you'd like
Typescript code generated to a file tree on github, in a manner that can be imported by deno.
A simple copy of the generated typescript transformed with a find & replace to make imports use a ".ts" suffix on files eg:
https://github.com/aws/aws-sdk-js-v3/blob/master/clients/client-s3/S3.ts#L1
would read "import { S3Client } from "./S3Client.ts";
would be a start.
Deno aims to be very browser compatible including http fetch API.
Describe alternatives you've considered
An alternative process could be to create a separate repo that watches this repo and transforms the typescript sources as required.
Another alternative is to address this request upstream to Smithy for typescript code-gen https://github.com/awslabs/smithy-typescript.
Additional context
https://deno.land/
The text was updated successfully, but these errors were encountered: