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

Allow easy debugging (setting breakpoints) of a Genkit app in VSCode #631

Open
pavelgj opened this issue Jul 16, 2024 · 2 comments
Open
Assignees
Labels
feature New feature or request

Comments

@pavelgj
Copy link
Collaborator

pavelgj commented Jul 16, 2024

Right now it's not possible to debug when running the app via genkit start because it Genkit CLI starts a sub-process and doesn't pass along debug settings (ex. can't pass --inspect flag to be able to attach a debugger).

Today you need to run your actual app in debug mode (F5). You'll need to set the env vars in the launch config...
You'll be able to set breakpoints, but you won't have the dev UI...
To get the dev ui you you need to manually set "GENKIT_ENV": "dev" and then attach the dev UI to the running process -- genkit start -a http://localhost:3100.

Would be great to have a "Debug Genkit App" VSCode option. This might require a Genkit VSCode extension.

@pavelgj pavelgj added the feature New feature or request label Jul 16, 2024
@chrisraygill chrisraygill removed the P1 label Jul 18, 2024
@dario-digregorio
Copy link

When using it with the firebase emulators together you can use this launch configuration:

{
      "type": "node",
      "request": "attach",
      "name": "Attach Functions",
      "port": 9229,
      "restart": true,
      "skipFiles": [
        "<node_internals>/**"
      ]
    },

But it does not work always. It seems like you need to call some function calls before the process attaches.

@pavelgj
Copy link
Collaborator Author

pavelgj commented Jul 26, 2024

When using it with the firebase emulators together you can use this launch configuration:

{
      "type": "node",
      "request": "attach",
      "name": "Attach Functions",
      "port": 9229,
      "restart": true,
      "skipFiles": [
        "<node_internals>/**"
      ]
    },

But it does not work always. It seems like you need to call some function calls before the process attaches.

You can specify --inspect-functions option which will initialize the functions without needing to manually invoke then first:

https://firebase.google.com/docs/genkit/firebase#developing_using_firebase_local_emulator_suite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: No status
Development

No branches or pull requests

3 participants