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

Difference between bun run and running the compiled binary - Deprecation warning url.parse #16639

Open
nickhobbs94 opened this issue Jan 23, 2025 · 3 comments · May be fixed by #16641
Open

Difference between bun run and running the compiled binary - Deprecation warning url.parse #16639

nickhobbs94 opened this issue Jan 23, 2025 · 3 comments · May be fixed by #16641
Assignees
Labels
bug Something isn't working build An issue related to building or compiling node:url

Comments

@nickhobbs94
Copy link

nickhobbs94 commented Jan 23, 2025

What version of Bun is running?

1.2.0+b0c5a7655

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

If I perform any axios request with a script envoked with bun run index.ts I see no deprecation warnings. But if I run the same script with bun build --compile index.ts --outfile out, ./out I see a DeprecationWarning for url.parse().

Here's an example script that shows the behaviour:

import axios from "axios";

const response = await axios.get('https://example.com');

What is the expected behavior?

I'd like to not see any unexpected deprecation warnings after compiling the binary. I'd be happy to simply turn off the warnings for the compiled binary.

What do you see instead?

DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
 code: "DEP0169"

      at urlParse (node:url:32:45)
      at getProxyForUrl (/$bunfs/root/out:9442:56)
      at setProxy (/$bunfs/root/out:11622:66)
      at <anonymous> (/$bunfs/root/out:11867:15)
      at dispatchHttpRequest (/$bunfs/root/out:11685:57)
      at <anonymous> (/$bunfs/root/out:11671:18)
      at new Promise (1:11)
      at wrapAsync (/$bunfs/root/out:11654:10)
      at dispatchRequest (/$bunfs/root/out:12640:17)

Additional information

I'm using axios 1.7.9 if that helps.

No response

@nickhobbs94 nickhobbs94 added bug Something isn't working needs triage labels Jan 23, 2025
@RiskyMH RiskyMH added build An issue related to building or compiling and removed needs triage labels Jan 23, 2025
@DonIsaac
Copy link
Contributor

Deprecation warnings for url.parse() are not emitted for files within node_modules. Bun determines this by scanning the call stack. You're seeing this warning now since compiled binaries have their paths clobbered.

@DonIsaac DonIsaac self-assigned this Jan 23, 2025
@DonIsaac
Copy link
Contributor

I'll make this warning respect process.noDeprecation. Once merged, just set it to true and you should be good to go.

@nickhobbs94
Copy link
Author

Awesome! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build An issue related to building or compiling node:url
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants