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

Support @aws-sdk packages #2465

Closed
daniel-price opened this issue Mar 23, 2023 · 3 comments
Closed

Support @aws-sdk packages #2465

daniel-price opened this issue Mar 23, 2023 · 3 comments
Labels
bug Something isn't working node.js Compatibility with Node.js APIs

Comments

@daniel-price
Copy link

daniel-price commented Mar 23, 2023

What version of Bun is running?

0.5.8

What platform is your computer?

Darwin 22.3.0 x86_64 i386

What steps can reproduce the bug?

Create the repo with dependency

mkdir bun_repo
cd bun_repo
bun i @aws-sdk/client-cloudformation
echo 'import { CloudFormationClient } from "@aws-sdk/client-cloudformation"; const cf = new CloudFormationClient({});' > index.ts
bun index.ts

This results in the first error:

error: Could not resolve: "http2". Maybe you need to "bun install"?

import { constants } from "http2";
                          ^
bun_repo/node_modules/@aws-sdk/node-http-handler/dist-es/node-http2-handler.js:3:27 146

We can get around this by installing http2

bun i http2
bun index.ts

But this results in another error:

1 | import { EndpointError } from "../types";
2 | import { callFunction } from "./callFunction";
   ^
ReferenceError: Cannot access uninitialized variable.
      at bun_repo/node_modules/@aws-sdk/util-endpoints/dist-es/utils/evaluateExpression.js:2:0

What is the expected behavior?

These errors should not be shown (they aren't with node)

What do you see instead?

No response

Additional information

Thanks for your help - I really love bun so far!

@daniel-price daniel-price added the bug Something isn't working label Mar 23, 2023
@Electroid
Copy link
Contributor

Thanks for reporting this issue. Yes, we need to implement the http2 module, which is being tracked here: #887

@Electroid Electroid added the node.js Compatibility with Node.js APIs label Mar 23, 2023
@Electroid Electroid changed the title Errors using @aws-sdk packages Support @aws-sdk packages Mar 23, 2023
@birkskyum
Copy link
Collaborator

birkskyum commented Aug 24, 2023

For some reason I don't get this http2 error with "@aws-sdk/client-cloudformation": "^3.398.0", and bun 0.8. When logging the created cf object it also mentions:

    requestHandler: {
      metadata: {
        handlerProtocol: "http/1.1"
      },
      configProvider: Promise { <pending> },
      resolveDefaultConfig: [Function: resolveDefaultConfig],
      destroy: [Function: destroy],
      handle: [Function: AsyncFunction]
    },

@daniel-price is this working for you now?

@daniel-price
Copy link
Author

@birkskyum I've just tried my reproduction and it now works. I will close this issue now, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node.js Compatibility with Node.js APIs
Projects
None yet
Development

No branches or pull requests

3 participants