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

Bun.s3 not being able to be built using target: "node" #17185

Closed
aLemonFox opened this issue Feb 8, 2025 · 5 comments
Closed

Bun.s3 not being able to be built using target: "node" #17185

aLemonFox opened this issue Feb 8, 2025 · 5 comments
Labels
bug Something isn't working s3

Comments

@aLemonFox
Copy link

aLemonFox commented Feb 8, 2025

What version of Bun is running?

1.2.2+c1708ea6a

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

The Bun s3 client cannot be build on any other target then "bun" (I am assuming no polyfill available as of today?)

// index.ts
import { S3Client } from 'bun';

// build.ts
await Bun.build({
    entrypoints: './index.ts',
    target: 'node',
    outdir: './dist',
});

// output:
import { S3Client } from 'bun';
                             ^
error: Could not resolve: "bun". Maybe you need to "bun install"?

What is the expected behavior?

Build succesfully like using target: "bun"

What do you see instead?

import { S3Client } from 'bun';
                             ^
error: Could not resolve: "bun". Maybe you need to "bun install"?

Additional information

No response

@aLemonFox aLemonFox added bug Something isn't working needs triage labels Feb 8, 2025
@DonIsaac
Copy link
Contributor

DonIsaac commented Feb 8, 2025

I'm slightly confused. Are you trying to run your built code with node?

@aLemonFox
Copy link
Author

Unfortuantly the serverless runtime we're using does not support Bun but using target:node we could compile to node (everything except for s3 works until now for us). This way we can keep our monorepo in bun which is way easier to manage than a nodejs monorepo :)

@kravetsone
Copy link

Unfortuantly the serverless runtime we're using does not support Bun but using target:node we could compile to node (everything except for s3 works until now for us). This way we can keep our monorepo in bun which is way easier to manage than a nodejs monorepo :)

If it will not be runned by Bun u should avoid any Bun specific api

@RiskyMH RiskyMH added s3 and removed needs triage labels Feb 8, 2025
@RiskyMH
Copy link
Member

RiskyMH commented Feb 8, 2025

Yeah you can "fix" this error by making "bun" external, but you will still need to use the bun runtime as there isn't pollyfills.

@DonIsaac
Copy link
Contributor

This doesn't seem like a bug. Unless @RiskyMH has any objections I think we can close this.

@RiskyMH RiskyMH closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working s3
Projects
None yet
Development

No branches or pull requests

4 participants