JavaScript promise rejection: TypeError: Cannot read properties of undefined (reading 'facebook.json'). Open browser console to see more details. #12505

Closed
opened 2025-11-02 10:12:04 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @xiaoxinpro on GitHub (Feb 20, 2024).

Description

Gitea upgraded from 1.20.5 to 1.21.5, and the Web frontend gives an error:

JavaScript promise rejection: TypeError: Cannot read properties of undefined (reading 'facebook.json'). Open browser console to see more details.

The problem persisted even after Chrome's cache was cleared.

browser console output:

VM32:8298 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'facebook.json')
    at getConfig (<anonymous>:8298:42)
    at ClickToLoad.init (<anonymous>:11099:37)
    at ClickToLoad.callInit (<anonymous>:3140:18)
    at <anonymous>:11401:33
    at Array.forEach (<anonymous>)
    at Object.init (<anonymous>:11399:26)
getConfig @ VM32:8298
init @ VM32:11099
callInit @ VM32:3140
(anonymous) @ VM32:11401
init @ VM32:11399
await in init (async)
apply @ VM32:11467
(anonymous) @ VM50:3
(anonymous) @ VM50:5
inject @ inject.js:114
(anonymous) @ inject.js:211
Show 2 more frames
Show less

Screenshots

image

Gitea Version

1.21.5

Can you reproduce the bug on the Gitea demo site?

No

Operating System

Windowns

Browser Version

Chrome 121.0.6167.185

Originally created by @xiaoxinpro on GitHub (Feb 20, 2024). ### Description Gitea upgraded from 1.20.5 to 1.21.5, and the Web frontend gives an error: ``` JavaScript promise rejection: TypeError: Cannot read properties of undefined (reading 'facebook.json'). Open browser console to see more details. ``` The problem persisted even after Chrome's cache was cleared. browser console output: ``` VM32:8298 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'facebook.json') at getConfig (<anonymous>:8298:42) at ClickToLoad.init (<anonymous>:11099:37) at ClickToLoad.callInit (<anonymous>:3140:18) at <anonymous>:11401:33 at Array.forEach (<anonymous>) at Object.init (<anonymous>:11399:26) getConfig @ VM32:8298 init @ VM32:11099 callInit @ VM32:3140 (anonymous) @ VM32:11401 init @ VM32:11399 await in init (async) apply @ VM32:11467 (anonymous) @ VM50:3 (anonymous) @ VM50:5 inject @ inject.js:114 (anonymous) @ inject.js:211 Show 2 more frames Show less ``` ### Screenshots ![image](https://github.com/go-gitea/gitea/assets/11443745/a7522d6c-036c-422b-819f-f7974cf55b4a) ### Gitea Version 1.21.5 ### Can you reproduce the bug on the Gitea demo site? No ### Operating System Windowns ### Browser Version Chrome 121.0.6167.185
GiteaMirror added the issue/needs-feedbacktopic/ui labels 2025-11-02 10:12:04 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Feb 20, 2024):

It is caused by your browser extension's bug.

https://stackoverflow.com/questions/76723154/uncaught-in-promise-typeerror-cannot-read-properties-of-undefined-reading-f

If you don't like to see the message, you could add your customized CSS styles to hide such prompts (.js-global-error { display: none; }

@wxiaoguang commented on GitHub (Feb 20, 2024): It is caused by your browser extension's bug. https://stackoverflow.com/questions/76723154/uncaught-in-promise-typeerror-cannot-read-properties-of-undefined-reading-f If you don't like to see the message, you could add your customized CSS styles to hide such prompts (`.js-global-error { display: none; }`
Author
Owner

@xiaoxinpro commented on GitHub (Feb 20, 2024):

It is caused by your browser extension's bug.

https://stackoverflow.com/questions/76723154/uncaught-in-promise-typeerror-cannot-read-properties-of-undefined-reading-f

If you don't like to see the message, you could add your customized CSS styles to hide such prompts (.js-global-error { display: none; }

@wxiaoguang Thanks, If it is a browser extension bug, try.gitea.io is fine.

@xiaoxinpro commented on GitHub (Feb 20, 2024): > It is caused by your browser extension's bug. > > https://stackoverflow.com/questions/76723154/uncaught-in-promise-typeerror-cannot-read-properties-of-undefined-reading-f > > If you don't like to see the message, you could add your customized CSS styles to hide such prompts (`.js-global-error { display: none; }` @wxiaoguang Thanks, If it is a browser extension bug, [try.gitea.io](https://try.gitea.io/) is fine.
Author
Owner

@xiaoxinpro commented on GitHub (Feb 20, 2024):

Closing the browser extension DuckDuckGo can resolve this issue

@xiaoxinpro commented on GitHub (Feb 20, 2024): Closing the browser extension `DuckDuckGo` can resolve this issue
Author
Owner

@silverwind commented on GitHub (Feb 20, 2024):

Maybe we can somehow detect when a error is not coming from our scripts, and don't display errors from third-party scripts based on script file path.

@silverwind commented on GitHub (Feb 20, 2024): Maybe we can somehow detect when a error is not coming from our scripts, and don't display errors from third-party scripts based on script file `path`.
Author
Owner

@silverwind commented on GitHub (Feb 20, 2024):

Can someone link the extension that causes this from Chrome Store/Mozilla Addons?

@silverwind commented on GitHub (Feb 20, 2024): Can someone link the extension that causes this from Chrome Store/Mozilla Addons?
Author
Owner

@wxiaoguang commented on GitHub (Feb 20, 2024):

Maybe we can somehow detect when a error is not coming from our scripts, and don't display errors from third-party scripts like extensions.

And maybe it's time to stop showing the JS errors to end users? Only show it in dev mode and for site admin?

@wxiaoguang commented on GitHub (Feb 20, 2024): > Maybe we can somehow detect when a error is not coming from our scripts, and don't display errors from third-party scripts like extensions. And maybe it's time to stop showing the JS errors to end users? Only show it in dev mode and for site admin?
Author
Owner

@silverwind commented on GitHub (Feb 20, 2024):

Maybe we can somehow detect when a error is not coming from our scripts, and don't display errors from third-party scripts like extensions.

And maybe it's time to stop showing the JS errors to end users? Only show it in dev mode and for site admin?

That'd also be an option, but I'm not sure I like it too much because sometimes we do get valuable issue reports from it.

@silverwind commented on GitHub (Feb 20, 2024): > > Maybe we can somehow detect when a error is not coming from our scripts, and don't display errors from third-party scripts like extensions. > > And maybe it's time to stop showing the JS errors to end users? Only show it in dev mode and for site admin? That'd also be an option, but I'm not sure I like it too much because sometimes we do get valuable issue reports from it.
Author
Owner

@silverwind commented on GitHub (Feb 20, 2024):

Can be reproduced with a Violentmonkey script:

// ==UserScript==
// @name        Gitea error trigger
// @match       http://localhost:3000/*
// ==/UserScript==
(async () => {
  throw new Error("error from userscript");
})()
@silverwind commented on GitHub (Feb 20, 2024): Can be reproduced with a Violentmonkey script: ```js // ==UserScript== // @name Gitea error trigger // @match http://localhost:3000/* // ==/UserScript== (async () => { throw new Error("error from userscript"); })() ```
Author
Owner

@silverwind commented on GitHub (Feb 20, 2024):

So I checked it: It is possible in Firefox to detect extension scripts via error.stack?.includes('moz-extension://'), but that does not work in Chrome which shows nothing clearly identifyable. So yes I think we should go with @wxiaoguang's suggestion.

@silverwind commented on GitHub (Feb 20, 2024): So I checked it: It is possible in Firefox to detect extension scripts via `error.stack?.includes('moz-extension://')`, but that does not work in Chrome which shows nothing clearly identifyable. So yes I think we should go with @wxiaoguang's suggestion.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12505