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

bug: deno compile creates a binary that doesn't properly handle HTTP redirects #26583

Closed
KnorpelSenf opened this issue Oct 27, 2024 · 3 comments · Fixed by #26586
Closed

bug: deno compile creates a binary that doesn't properly handle HTTP redirects #26583

KnorpelSenf opened this issue Oct 27, 2024 · 3 comments · Fixed by #26586
Assignees
Labels
bug Something isn't working correctly compile related to the `deno compile` feature

Comments

@KnorpelSenf
Copy link
Contributor

KnorpelSenf commented Oct 27, 2024

Version: Deno 2.0.3

Repro

Create any script with an HTTP import, such as this one:

// /tmp/main.ts
import { Bot } from "https://deno.land/x/grammy/mod.ts";

const bot = new Bot("secret-token");
console.log(bot.token);

Compile it and run the binary.

# /tmp/repro.sh
set -e
deno install --reload --allow-import --entrypoint /tmp/main.ts
deno compile -Ao /tmp/app /tmp/main.ts
/tmp/app

You will see the following output.

error: Module not found: https://deno.land/x/grammy/bot.ts

Instead, it is expected that the script runs correctly and that the output is just secret-token.

Cause

This works correctly with 2.0.2.

I used git bisect to narrow it down to #26494. /cc @dsherret

@KnorpelSenf
Copy link
Contributor Author

Note that https://deno.land/x/grammy/mod.ts re-exports Bot (src) so my guess is that the binary only contains the modules that are imported directly, but not those that get imported transitively.

@dsherret dsherret added bug Something isn't working correctly compile related to the `deno compile` feature labels Oct 27, 2024
@dsherret
Copy link
Member

dsherret commented Oct 27, 2024

I think it’s not properly handling redirects. If you import the resolved specifier it will probably work.

@dsherret dsherret self-assigned this Oct 27, 2024
@KnorpelSenf KnorpelSenf changed the title deno compile creates a binary that cannot find its HTTP import dependencies bug: deno compile creates a binary that cannot find its HTTP import dependencies Oct 27, 2024
@KnorpelSenf
Copy link
Contributor Author

I think it’s missing redirects. If you import the resolved specifier it will probably work.

Can confirm that this fixed it.

@dsherret dsherret changed the title bug: deno compile creates a binary that cannot find its HTTP import dependencies bug: deno compile creates a binary that doesn't properly handle HTTP redirects Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly compile related to the `deno compile` feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants