pixiebrix / pixiebrix-extension

PixieBrix browser extension
https://www.pixiebrix.com
GNU Affero General Public License v3.0
82 stars 22 forks source link

RENDER_NUNJUCKS not available within 3 seconds #8220

Open twschiller opened 2 months ago

twschiller commented 2 months ago

Describe the bug

To Reproduce

The error is intermittent. What @brittanyjoiner15 is seeing is most likely that either: 1) a selection watch trigger is failing, or 2) a page load trigger (e.g., to fetch announcements) is failing on some pages

Likely steps to reproduce:

Actual behavior

Discussion

Potential Solution

brittanyjoiner15 commented 2 months ago

image

This just happened again, i think it's relating to the announcements mod.

brittanyjoiner15 commented 2 months ago

I'm not seeing anything in the logs, but it did seem to fix itself without me doing anything

brittanyjoiner15 commented 2 months ago

FInally got into the logs in time - confirmed its the announcements mod image

brittanyjoiner15 commented 2 months ago

I believe its this brick?

image

twschiller commented 2 months ago

@brittanyjoiner15 thanks for the information. For this kind of issue, know which sites it's happening on is most valuable. What's happening is that either the page load or something else on the page is obstructing our extension

twschiller commented 2 months ago

Have been able to replicate sporadically. Will add more logging to my repro mod to collect information

image

Some examples: image

twschiller commented 2 months ago

I managed to get the error from the KB Assist selection trigger during the normal course of writing up a Github issue. That happened even though I had been on the page for a while:

image

Perhaps there was something else blocking the CPUs for the sandbox? Their editor is not in a sandbox

One thing that's curious is that for that brick (plus Britt's) it's occurring during template evaluation for the condition for the brick: https://github.com/pixiebrix/pixiebrix-extension/blob/94280579a2a2e8bbd0ed420a0bd8dd8c35b30aa2/src/runtime/runtimeUtils.ts#L152-L152

brittanyjoiner15 commented 2 months ago

@twschiller been using your mod, and i think pixiebrix is trying to tell me not to check my amazon orders during work hours 😂 (seems like that triggers the mod)

image

brittanyjoiner15 commented 2 months ago

Happened again, this time in slack. Don't think the mod ran though, because i didn't see the window alert with the url. Just saw the render_nunjucks error.

brittanyjoiner15 commented 2 months ago

I'm still assuming this is related to the mod that @twschiller made that i added that will report the business errors and show these URLs. I just got an error on https://app.pixiebrix.com/admin/marketplace/listing/?q=%40pixiebrix%2Fcommand%2Ftext-command

It showed the URL but then also showed an error with the URL. Of course i can't reproduce now that i didn't get a screenshot

brittanyjoiner15 commented 2 months ago

Another instance in Slack image

twschiller commented 2 months ago

Potentially related to https://github.com/pixiebrix/pixiebrix-extension/issues/8168 if the sidebar is just loading slowly vs. not loading at all

brittanyjoiner15 commented 2 months ago

Happening on LinkedIn in frames: image

grahamlangford commented 3 days ago

Impacting external users: https://pixiebrix.slack.com/archives/C023KL47XV4/p1720029626794029

@twschiller, I'm prioritizing this for 2.0.5, see slack thread for context

Since manually re-running triggers in the PageEditor seems to work as a workaround, I'm proposing we simply use p-retry similar to https://github.com/pixiebrix/pixiebrix-extension/pull/8474. If you agree, please unassign yourself, and the first available engineer can work on it

twschiller commented 3 days ago

@grahamlangford I agree - let's prioritize. As you mention, first step should be attempting to retry the messages that call into the Sandbox: https://github.com/pixiebrix/pixiebrix-extension/blob/72334200b17050bde676dbf234650f147f53ac8a/src/sandbox/messenger/api.ts#L39-L39

The next thing I'd look to do is have the retry check if the sandbox actually exists. If not, it needs to clear the loadSandbox promise cache and re-inject the sandbox: https://github.com/pixiebrix/pixiebrix-extension/blob/72334200b17050bde676dbf234650f147f53ac8a/src/sandbox/messenger/api.ts#L26-L26

We might want to track if the sandbox needs to be re-injected (more than once?) and provide some telemetry so we can see which site is messing with the sandbox