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

Api-side context isn't available to the VS Code debugger #5373

Open
jtoar opened this issue May 1, 2022 · 8 comments
Open

Api-side context isn't available to the VS Code debugger #5373

jtoar opened this issue May 1, 2022 · 8 comments
Labels

Comments

@jtoar
Copy link
Contributor

jtoar commented May 1, 2022

The global context object that's available to services doesn't seem to show up in the VS Code debugger.

@jtoar jtoar added the bug/confirmed We have confirmed this is a bug label May 1, 2022
@jtoar jtoar changed the title context isn't available to the VS Code debugger Api-side context isn't available to the VS Code debugger May 1, 2022
@jtoar
Copy link
Contributor Author

jtoar commented May 2, 2022

Workaround posted in the discord:

One thing that works for debugging for now is something like let lclcontext=context in your service. Then you should have access the the variable . But it would be nice to solve it properly !

Link: https://discord.com/channels/679514959968993311/970282715343642694/970417178153213953

@IThinkThatsKirby
Copy link
Contributor

This looks interesting. I will look into this.

@IThinkThatsKirby
Copy link
Contributor

I regret looking into this.

@pantheredeye
Copy link
Collaborator

@IThinkThatsKirby What path did you take, what did you learn or what roadblock did you hit? Debugging is, for me, sort of a black box. So, I would be interested to hear any thoughts you have had. Discord is just as good a place to talk, if you are willing to talk, and if you don't want to muddy up the topic here.

@IThinkThatsKirby
Copy link
Contributor

@pantheredeye
I have researched everything from how to declare typescript global variables to graphql resolution variables. VS code advertises their debugging as "it just works" and I'm beginning to think that's a lie. I gave myself burnout from all the docs I've read. Now I'm just trying to break things and see If I kan use that to help me figure out what's going on. So far I've managed to make context show up as a local variable.

@IThinkThatsKirby
Copy link
Contributor

So far I believe this is not really an issue.

@IThinkThatsKirby
Copy link
Contributor

IThinkThatsKirby commented Sep 13, 2022

I took a walk and bounced some ideas off my 2 year old. I think context is not going to show up as a global variable in VS Code's debugger. The way its created is more of a pointer to where its located and is defined from a return in a function that does not get run until context is referenced. So due to hoisting its referenced as a local variable when ever it is called. I will do a test to verify this hypothesis and report back my findings tomorrow after lunch.

OK so ill be spending the next few days learning how to make frameworks in typescript. then do the experiment.

@IThinkThatsKirby
Copy link
Contributor

IThinkThatsKirby commented Sep 16, 2022

I kant find any docs on HOW vscode debugger works, we need a debugger for the vscode debugger so we kan debug while we debug. I am 100% in the camp of its not actually global in the way JavaScript is run in the node or browser environment.
Its never hoisted high enough because its never defined. So it really doesn't exist unless called, and this context variable seems unique to graphql resolvers for what I'm assuming are security reasons? I think its scope is also limited because it appears to be a response from a function that we then assign the value to a variable ONLY when the variable is requested. It would be great if someone with more experience in this department to take a look. I'd hate to be spittin' factn'ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

3 participants