How to reliably avoid "Tried to access browser too early in startup." errors?
#334
Unanswered
ian-h-chamberlain
asked this question in
Issue triage
Replies: 1 comment
|
Just wrap it with |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi, I've been running into this error in various cases, and sometimes it seems easy to fix but not always. For example, I recently tried adding something like this to my config:
This seems to work most of the time, but every once in a while I see the error message
Tried to access `browser` too early in startup.appear, and it points to this line in my config! I was surprised at this since I figured theUrlEnterwould ensure the browser API was available).I can't reproduce it super-reliably, but it always seems to happen when I'm opening a new tab for the given website (in one case as a private browsing window).
So I guess two questions:
Is this a bug, or am I doing something wrong here? Like maybe I should be using a different event, or a different API or something?
More generally, is there a way to make sure the browser API is available, when called from various kinds of autocmds? Something like
await glide.browser_api_ready()or evenawait glide.browser().then((browser) => browser.cookies.get(...)maybe?Maybe this would just be sidestepping the problem, but I probably wouldn't mind waiting a little longer in most cases to make sure the browser calls I'm making actually happen instead of throwing an error.
Thanks in advance!
All reactions