VeryGoodOpenSource / dart_frog

A fast, minimalistic backend framework for Dart 🎯
https://dartfrog.vgv.dev
MIT License
1.82k stars 148 forks source link

fix: Vs Code debugger does not use https protocol when starting dev server #1440

Open Tusshu opened 2 months ago

Tusshu commented 2 months ago

Description

  1. Created security context for method serve(handler, ip, port, securityContext: securityContext) as listed in the documentation.
  2. Ran the dev server using Dart Frog: Start and Debug Development server option in the Command Pallet of VS code.
  3. Specified port as 8443 when asked "which port number server should start on"
  4. Specified 8181 when asked "Which port number the Dart VM server should listen"
  5. Browser opens up and shows http://localhost:8443/ in the URL window and following message: 6 This site can’t be reached. The webpage at https://localhost:8443/ might be temporarily down or it may have moved permanently to a new web address. ERR_FAILED

Expected Behavior

  1. Response returned in index.dart page is expected to be displayed.
  2. https protocol to be shown in URL when security context used in the serve() call in run() method.
alestiago commented 2 months ago

@Tusshu thanks for opening an issue!

I haven't tried to reproduce, but as far as I believe what you're stating is a valid request. The browser should open with https when a security context is specified. I believe there is no logic in place in the VS Code extension to cater for such use-case right now.

As far as I am concerned, the Dart Frog Daemon doesn't report the information on whether or not the Dart Frog project is using a Security Context or not. Hence, to land this change we would have to:

I'm not sure if the team has bandwidth to prioritise this work right now (cc: @tomarra ), however, if you're interested in contributing to this effort we can definitely help you review and land the Pull Request.

Tusshu commented 1 month ago

Thanks for your response! I would love to do what you are suggesting. But with current assignments, it will be difficult to find the time this task requires. I will try to understand the code as and when I find some time but I am not able to commit.

Currently I will continue my project using Shelf. But I was impressed with Dart_frog and really wanted to move to that platform.

Thank you again for your response.

Tushar Kale

On Tue, Jul 9, 2024 at 5:01 AM Alejandro Santiago @.***> wrote:

@Tusshu https://github.com/Tusshu thanks for opening an issue!

I haven't tried to reproduce, but as far as I believe what you're stating is a valid request. The browser should open with https when a security context is specified.

As far as I am concerned, the Dart Frog Daemon doesn't report the information on whether or not the Dart Frog project is using a Security Context or not. Hence, to land this change we would have to:

  • Update the Daemon to report if a security context is being specified
  • Update the VS Code extension to check with the Daemon if the current Dart Frog project is using a security context and open with HTTPS accordingly

I'm not sure if the team has bandwidth to prioritise this work right now (cc: @tomarra https://github.com/tomarra ), however, if you're interested in contributing to this effort we can definitely help you review and land the Pull Request.

— Reply to this email directly, view it on GitHub https://github.com/VeryGoodOpenSource/dart_frog/issues/1440#issuecomment-2217044119, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4AJMA43U4XRFOD3EPO2FTZLORGLAVCNFSM6AAAAABKNYFOLKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJXGA2DIMJRHE . You are receiving this because you were mentioned.Message ID: @.***>

alestiago commented 3 weeks ago

@Tusshu no worries I understand. You can still use Dart Frog and launch using Dart Frog CLI instead of the extension, or simply update the URL to include the "s" manually.

If at any point you would like to contribute let me know and I can get you assigned. For the time being you can track how the team prioritises this issue by watching it within the Full Board.

Tusshu commented 3 weeks ago

That is good news!!! You mentioned "simply update the URL to include the "s" manually" I am not sure how to do that. In VSCode, I click on the Run | Debug above the response function to start the server. It asks for two ports, 8080 and 8081 before starting the server. I can specify 8443 instead of 8080. But there is no access to URL where I can specify https.
How or where do I get access to the URL? Thanks!

Tusshu commented 2 weeks ago

You mentioned "simply update the URL to include the "s" manually" I am not sure how to do that. In VSCode, I click on the Run | Debug above the response function to start the server. It asks for two ports, 8080 and 8081 before starting the server. I can specify 8443 instead of 8080. But there is no access to the URL where I can specify https. How or where do I get access to the URL? Thanks!

On Tue, Aug 13, 2024 at 7:12 AM Alejandro Santiago @.***> wrote:

@Tusshu https://github.com/Tusshu no worries I understand. You can still use Dart Frog and launch using Dart Frog CLI instead of the extension, or simply update the URL to include the "s" manually.

If at any point you would like to contribute let me know and I can get you assigned. For the time being you can track how the team prioritises this issue by watching it within the Full Board https://github.com/orgs/VeryGoodOpenSource/projects/1/views/4.

— Reply to this email directly, view it on GitHub https://github.com/VeryGoodOpenSource/dart_frog/issues/1440#issuecomment-2285988288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4AJMAKOOO4IDPPH6RBNPTZRHS3DAVCNFSM6AAAAABKNYFOLKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBVHE4DQMRYHA . You are receiving this because you were mentioned.Message ID: @.***>

alestiago commented 1 week ago

You first need to set the security context as specified in the documentation.

Once you have that going, you can attach a debugger by using the "Debug" above the response function, such will open a web browser, but using HTTP rather than HTTPS. If you modify the browser URL to include an "s", you'll see how the breakpoints are hit when in debug mode. Another option is to use tools like Postman, curl, and use the endpoint you wish.

I hope this makes sense 🙌 , let me know if it helps.