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

async / await debug in chrome #6056

Closed
pomelio opened this issue Feb 21, 2016 · 16 comments
Closed

async / await debug in chrome #6056

pomelio opened this issue Feb 21, 2016 · 16 comments
Labels
Debugger Issues related to React Native DevTools or legacy JavaScript/Hermes debugging DX Issues concerning how the developer experience can be improved. Ran Commands One of our bots successfully processed a command. Resolution: Backlog An issue that should be solved at some point, but it's not in the immediate roadmap. Resolution: Locked This issue was locked by the bot.

Comments

@pomelio
Copy link

pomelio commented Feb 21, 2016

after changing the promise to async await, I found debugging in chrome is impossible. Is there any plan to fix this in the near future or should I switch back to promise ?

@mkonicek
Copy link
Contributor

Hey @jaynsw, in order to be able to help you with this issue you need to provide some code samples. What doesn't work exactly? Where did you put the breakpoint?

I have a question for you. Did you see the New Issue Guidelines when creating this issue? Is there anything we could improve there? Is the text too long or unclear for example?

@mkonicek mkonicek reopened this Feb 21, 2016
@Somojojojo
Copy link

I'll post my experience here, since the OP hasn't responded yet.

Debugging async/await in chrome is extremely difficult. Maybe because of my inexperience with the inner workings of how it works, I'm not sure. But when you have code like so:

1. let response = await getSomethingFromTheNetwork();
2. let bar = response.foo;
3. doSomethingWithFoobar(bar);

In Chrome if I place a breakpoint at line 2, the debugger will pause the application on that line and response will be undefined. Obviously this is not desirable behaviour, and you'd expect response to have been resolved by the time the debugger breaks at line 2.

Does this make sense?

@pomelio
Copy link
Author

pomelio commented Feb 26, 2016

I have changed back all of my code to promise then and catch.
On 26 Feb 2016 11:11 AM, "Kyle Somogyi" notifications@github.com wrote:

I'll post my experience here, since the OP hasn't responded yet.

Debugging async/await in chrome is extremely difficult. Maybe because of
my inexperience with the inner workings of how it works, I'm not sure. But
when you have code like so:

  1. let response = await getSomethingFromTheNetwork();2. let bar = response.foo;3. doSomethingWithFoobar(bar);

In Chrome if I place a breakpoint at line 2, the debugger will pause the
application on that line and response will be undefined. Obviously this
is not desirable behaviour, and you'd expect response to have been resolved
by the time the debugger breaks at line 2.

Does this make sense?


Reply to this email directly or view it on GitHub
#6056 (comment)
.

@mkonicek
Copy link
Contributor

mkonicek commented Mar 4, 2016

Thanks for the example @Somojojojo! Any idea how to make Chrome show you the value of response?

@Somojojojo
Copy link

Besides using the console JS API I haven't found a solid way of getting those values.
I haven't read into how React is managing the Chrome debug session at all, and I haven't had any experience managing it myself. At a high level, I would say you could defer breakpoints inside an async function the same way you defer code execution. As code execution progresses in an async function, you would execute breakpoints belonging to that call. In theory that would keep the debugger and the async function state synchronized. This is assuming you have power over if/when breakpoints are executed.

Again, as I have no idea how React is managing the debug session, my explanation likely sounds silly or obvious – but maybe it will give someone a good idea on how to solve this.

@mkonicek
Copy link
Contributor

This looks like a feature request and I'm not sure anyone on the team has bandwidth to look into it. Let's vote on it on Product Pains (voting is not possible on GitHub) so we see how high-priority this is.

@mkonicek
Copy link
Contributor

@facebook-github-bot feature

@facebook-github-bot
Copy link
Contributor

Hey @jaynsw! Thanks for opening the issue, however it looks like a feature request. As noted in the Issue template we'd like to use the GitHub issues to track bugs only. Can you implement the feature as a standalone npm module? If not consider sending a pull request or a create an entry on Product Pains. It has a voting system and if the feature gets upvoted enough it might get implemented.

@facebook-github-bot
Copy link
Contributor

Hey @jaynsw! Thanks for opening the issue, but we are closing it because it looks like a feature request. If this can't be implemented as a standalone npm module free to send us a Pull Request or create an entry on Product Pains. It has a voting system and if the feature gets upvoted enough it might get implemented.'

@facebook-github-bot facebook-github-bot added the Ran Commands One of our bots successfully processed a command. label Mar 20, 2016
@mkonicek
Copy link
Contributor

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/async-await-debug-in-chrome

ProductPains helps the community prioritize the most important issues thanks to its voting feature.
It is easy to use - just login with GitHub. GitHub issues have voting too, nevertheless
Product Pains has been very useful in highlighting the top bugs and feature requests:
https://productpains.com/product/react-native?tab=top

Also, if this issue is a bug, please consider sending a pull request with a fix.
We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.

@mikecg
Copy link

mikecg commented May 1, 2018

@mkonicek Hello... has this feature been implemented? If not, is there a workaround?

@melissachang
Copy link

I believe async/await debugging in Chrome is currently broken:

https://bugs.chromium.org/p/chromium/issues/detail?id=833928

@aslushnikov FYI

@mikecg
Copy link

mikecg commented May 1, 2018

@Somojojojo I know this thread is old but I am having a similar experience. Are you still using react native and seeing the same difficult async/await debugging experience in Chrome? If so, did you come up with a better workaround for debugging?

@lhrolim
Copy link

lhrolim commented Jun 5, 2018

I'm still experiencing that using RN 0.55.4

Are there any workarounds available?

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
@kelset
Copy link
Contributor

kelset commented Mar 28, 2019

Ok it looks like the chromium bug is still there, so there isn't much we can do about it for now AFAIK.

Still, let's reopen this.

@kelset kelset reopened this Mar 28, 2019
@kelset kelset added DX Issues concerning how the developer experience can be improved. Debugger Issues related to React Native DevTools or legacy JavaScript/Hermes debugging labels Mar 28, 2019
@hramos hramos added the Resolution: Backlog An issue that should be solved at some point, but it's not in the immediate roadmap. label Mar 28, 2019
@cpojer
Copy link
Contributor

cpojer commented May 9, 2019

Since this is not actionable in the RN repo and an issue with Chromium, let's close this issue here since we can't do anything about it.

@cpojer cpojer closed this as completed May 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Debugger Issues related to React Native DevTools or legacy JavaScript/Hermes debugging DX Issues concerning how the developer experience can be improved. Ran Commands One of our bots successfully processed a command. Resolution: Backlog An issue that should be solved at some point, but it's not in the immediate roadmap. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests