Giter Club home page Giter Club logo

Comments (41)

Xuanwo avatar Xuanwo commented on July 18, 2024 2

Unfortunately, nothing changed, the issue still exists.

Interesing, let's dive deeper. Are you ready to start this journey?

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024 2

Thanks for the new log. I will checkout tomorrow ๐Ÿฅฐ

from openai-translator.

junaire avatar junaire commented on July 18, 2024 1

I'm unfamiliar with frontend techstack so I googled it a bit and I found my UI is somehow different than what I saw in the internet. (No Application page but Storage). Below is the screenshot and I can't found indexeddb.
image

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024 1

Yes, that's really weird. Here is my side:

image

Seems indexeddb in your webkit doesn't work well.

Please try the following js in devtools:

let db;
const request = indexedDB.open("MyTestDatabase");
request.onerror = (event) => {
    console.error("Why didn't you allow my web app to use IndexedDB?!");
};
request.onsuccess = (event) => {
    console.info("Load success");
    db = event.target.result;
};

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024 1

Hi, @junaire, to make it's easier to debug, I setup a repro project at https://github.com/Xuanwo/tauri-indexeddb-openfailed. Would you like to give it a try?

It's an empty project that did nothing. If we can still reproduce this issue, it's must be not related to openai-translator.

from openai-translator.

junaire avatar junaire commented on July 18, 2024 1

Hi, @Xuanwo @yetone I think I fixed the bug. I bet this is the most weird bug I ever seen in my life. Still I don't understand why this happens, but it indeed works. Below is my fix:

diff --git a/src/common/services/promotion.ts b/src/common/services/promotion.ts
index 5ec9cd7..0f95beb 100644
--- a/src/common/services/promotion.ts
+++ b/src/common/services/promotion.ts
@@ -36,14 +36,7 @@ export interface IPromotionResponse {
 }

 export async function fetchPromotions(): Promise<IPromotionResponse> {
-    const resp = await fetch(
-        `https://raw.githubusercontent.com/yetone/openai-translator-configs/main/promotions.json?ts=${Date.now()}`,
-        { cache: 'no-cache' }
-    )
-    if (!resp.ok) {
-        throw new Error(resp.statusText)
-    }
-    return resp.json()
+    return {}
 }

Note it's not about failing to fetch config, it's about fetch itself! As long as you return an empty json, we're good...
I tried to replace the URL to www.example.com and returned {} the bug still reproduces. Any ideas about how fetch could affect the behavior of IndexedDB?

from openai-translator.

junaire avatar junaire commented on July 18, 2024 1

I tried to replace the URL to www.example.com and returned {} the bug still reproduces.

Does fetch return 'ok'? Or does the indexeddb break regardless of what fetch returns, as soon as we call it?

Nah, looks like whatever I try to fetch the only thing I got is Failed to load resource: WebKit encountered an internal error, even in the console.

It even failed to connect to my local server created by python3 -m http.server , but with a slightly different error message Connection terminated unexpectedly

from openai-translator.

junaire avatar junaire commented on July 18, 2024 1

It even failed to connect to my local server created by python3 -m http.server , but with a slightly different error message Connection terminated unexpectedly

That's really weird. Do you have http proxy settings or something? Try cleanup them all and try again.

OMG, I disabled the proxy settings in the global settings then it works! With any patches applied!

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024 1

Great, with NO_PROXY=127.0.0.0/8, I can reproduce the same error.

I think linux's no proxy setting doesn't support ip ranges, thus 127.0.0.0/8 doesn't work as you expected. So all requests to 127.0.0.1 failed which indexeddb depends on too.

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

3. ๅ‡บ็Žฐไพ่ต–้”™่ฏฏ๏ผŒไฝฟ็”จ sudo apt --fix-broken install ไฟฎๅค

What's the error? open-ai-translator is packaged under ubuntu-22.04, it should work just fine on it.

from openai-translator.

junaire avatar junaire commented on July 18, 2024
  1. ๅ‡บ็Žฐไพ่ต–้”™่ฏฏ๏ผŒไฝฟ็”จ sudo apt --fix-broken install ไฟฎๅค

What's the error? open-ai-translator is packaged under ubuntu-22.04, it should work just fine on it.

deb package could depend on other packages so I don't think that's related. I just tried the latest release with AppImage (which should be self-contained), and I found:
The initial UI works fine, but when I clicked the settings icon, it shows the error:
image

Clicked the Try again button reproduces the original error message:
image

I have already built the project and run it in the command line, and I can confirm this still reproduces on main, but the console shows no logs so I don't know where to look at...

from openai-translator.

junaire avatar junaire commented on July 18, 2024

I highly suspect this is an upstream issue...

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

Seems some wrong on your config dir: openai-translator will write config to $XDG_CONFIG_HOME/xyz.yetone.apps.openai-translator/config.json. Do you have XDG_CONFIG_HOME or HOME configured? Can openai-translator access ~/.config or ~/.cache?

You can try print those env value during startup.

from openai-translator.

junaire avatar junaire commented on July 18, 2024

Seems some wrong on your config dir: openai-translator will write config to $XDG_CONFIG_HOME/xyz.yetone.apps.openai-translator/config.json. Do you have XDG_CONFIG_HOME or HOME configured? Can openai-translator access ~/.config or ~/.cache?

You can try print those env value during startup.

โฏ echo $HOME
/home/jun
โฏ echo $XDG_CONFIG_HOME

โฏ ls -al ~/.config/xyz.yetone.apps.openai-translator/
total 12
drwxrwxr-x  2 jun jun 4096  3ๆœˆ 29 15:03 .
drwx------ 48 jun jun 4096  4ๆœˆ 22 22:19 ..
-rw-rw-r--  1 jun jun 1048  4ๆœˆ 22 23:15 config.json
โฏ ls -al ~/.cache/open-ai-translator
total 16
drwxrwxr-x  4 jun jun 4096  3ๆœˆ 29 15:03 .
drwx------ 57 jun jun 4096  4ๆœˆ 22 23:21 ..
drwxrwxr-x  2 jun jun 4096  3ๆœˆ 29 15:03 CacheStorage
drwxrwxr-x  3 jun jun 4096  3ๆœˆ 29 15:03 WebKitCache

Not sure but openai translator does write something into the desired directories...

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

Please also check ~/.local/share/xyz.yetone.apps.openai-translator. I expect to see:

/home/xuanwo/.local/share/xyz.yetone.apps.openai-translator/
โ”œโ”€โ”€ databases
โ”‚ย ย  โ””โ”€โ”€ indexeddb
โ”‚ย ย      โ”œโ”€โ”€ v0 -> /home/xuanwo/.local/share/xyz.yetone.apps.openai-translator/databases/indexeddb
โ”‚ย ย      โ””โ”€โ”€ v1
โ”‚ย ย          โ””โ”€โ”€ tauri_localhost_0
โ”‚ย ย              โ””โ”€โ”€ E245F118A2329D74BB22E76C9F89A7C7032203F1EE2C611EE7E19D6B6D1EB50B
โ”‚ย ย                  โ”œโ”€โ”€ IndexedDB.sqlite3
โ”‚ย ย                  โ”œโ”€โ”€ IndexedDB.sqlite3-shm
โ”‚ย ย                  โ””โ”€โ”€ IndexedDB.sqlite3-wal
โ””โ”€โ”€ localstorage
    โ”œโ”€โ”€ tauri_localhost_0.localstorage
    โ”œโ”€โ”€ tauri_localhost_0.localstorage-shm
    โ””โ”€โ”€ tauri_localhost_0.localstorage-wal

8 directories, 6 files

Try removing them all if there are some old content there.

from openai-translator.

junaire avatar junaire commented on July 18, 2024

Please also check ~/.local/share/xyz.yetone.apps.openai-translator. I expect to see:

/home/xuanwo/.local/share/xyz.yetone.apps.openai-translator/
โ”œโ”€โ”€ databases
โ”‚ย ย  โ””โ”€โ”€ indexeddb
โ”‚ย ย      โ”œโ”€โ”€ v0 -> /home/xuanwo/.local/share/xyz.yetone.apps.openai-translator/databases/indexeddb
โ”‚ย ย      โ””โ”€โ”€ v1
โ”‚ย ย          โ””โ”€โ”€ tauri_localhost_0
โ”‚ย ย              โ””โ”€โ”€ E245F118A2329D74BB22E76C9F89A7C7032203F1EE2C611EE7E19D6B6D1EB50B
โ”‚ย ย                  โ”œโ”€โ”€ IndexedDB.sqlite3
โ”‚ย ย                  โ”œโ”€โ”€ IndexedDB.sqlite3-shm
โ”‚ย ย                  โ””โ”€โ”€ IndexedDB.sqlite3-wal
โ””โ”€โ”€ localstorage
    โ”œโ”€โ”€ tauri_localhost_0.localstorage
    โ”œโ”€โ”€ tauri_localhost_0.localstorage-shm
    โ””โ”€โ”€ tauri_localhost_0.localstorage-wal

8 directories, 6 files

Try removing them all if there are some old content there.

I removed every old stuff and downloaded the latest version. Below is my results:

.
โ””โ”€โ”€ databases
    โ””โ”€โ”€ indexeddb
        โ”œโ”€โ”€ databases
        โ”‚ย ย  โ””โ”€โ”€ indexeddb
        โ”‚ย ย      โ”œโ”€โ”€ v0 -> /home/jun/.local/share/xyz.yetone.apps.openai-translator/databases/indexeddb/databases/indexeddb
        โ”‚ย ย      โ””โ”€โ”€ v1
        โ”‚ย ย          โ””โ”€โ”€ tauri_localhost_0
        โ”‚ย ย              โ””โ”€โ”€ E245F118A2329D74BB22E76C9F89A7C7032203F1EE2C611EE7E19D6B6D1EB50B
        โ”‚ย ย                  โ”œโ”€โ”€ IndexedDB.sqlite3
        โ”‚ย ย                  โ”œโ”€โ”€ IndexedDB.sqlite3-shm
        โ”‚ย ย                  โ””โ”€โ”€ IndexedDB.sqlite3-wal
        โ”œโ”€โ”€ deviceidhashsalts
        โ”‚ย ย  โ””โ”€โ”€ 1
        โ”œโ”€โ”€ localstorage
        โ”‚ย ย  โ”œโ”€โ”€ tauri_localhost_0.localstorage
        โ”‚ย ย  โ”œโ”€โ”€ tauri_localhost_0.localstorage-shm
        โ”‚ย ย  โ””โ”€โ”€ tauri_localhost_0.localstorage-wal
        โ”œโ”€โ”€ mediakeys
        โ”‚ย ย  โ””โ”€โ”€ v1
        โ”‚ย ย      โ””โ”€โ”€ salt
        โ””โ”€โ”€ storage
            โ”œโ”€โ”€ salt
            โ””โ”€โ”€ SNVKpYwvLVxYgAmL-TXRKis9kf_53dJf3ir83LKJBTM
                โ””โ”€โ”€ SNVKpYwvLVxYgAmL-TXRKis9kf_53dJf3ir83LKJBTM
                    โ””โ”€โ”€ origin

16 directories, 9 files

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

downloaded

What does downloaded mean? This issue still exist after cleanup ~/.local/share/xyz.yetone.apps.openai-translator/?

from openai-translator.

junaire avatar junaire commented on July 18, 2024

downloaded

What does downloaded mean? This issue still exist after cleanup ~/.local/share/xyz.yetone.apps.openai-translator/?

Unfortunately, nothing changed, the issue still exists.

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

Hi, @junaire, please call cargo tauri dev under project root. You can right click the poped up windows to open devtools:

image

Please print the error message in console you can find.

from openai-translator.

junaire avatar junaire commented on July 18, 2024

Hi, @junaire, please call cargo tauri dev under project root. You can right click the poped up windows to open devtools:

image

Please print the error message in console you can find.

Thanks, now I know the right way to debug this. Below is my logs when I clicked the settings button:

[Log] OpenFailedError (ErrorFallback.tsx, line 21)
[Error] The above error occurred in the <TranslateModeSelector> component:

TranslateModeSelector@http://localhost:3333/src/common/components/Settings.tsx:122:8
div
@http://localhost:3333/node_modules/.vite/deps/chunk-LR4KRP27.js:454:40
Styled(div)
UID2@http://localhost:3333/node_modules/.vite/deps/chunk-C7D3XKWM.js:121:50
UIDConsumer@http://localhost:3333/node_modules/.vite/deps/chunk-C7D3XKWM.js:150:16
FormControl2@http://localhost:3333/node_modules/.vite/deps/baseui-sd_form-control.js:257:20
Field2@http://localhost:3333/node_modules/.vite/deps/rc-field-form.js:2250:20
WrapperField@http://localhost:3333/node_modules/.vite/deps/rc-field-form.js:2639:19
div
FormItem@http://localhost:3333/src/common/components/Form/item.tsx:21:16
FormItem
div
div
form
Form2@http://localhost:3333/node_modules/.vite/deps/rc-field-form.js:3739:18
@http://localhost:3333/src/common/components/Form/form.ts:109:16
div
InnerSettings@http://localhost:3333/src/common/components/Settings.tsx:1415:9
div
InnerTranslator@http://localhost:3333/src/common/components/Translator.tsx:473:51
Suspense
GlobalSuspense@http://localhost:3333/src/common/components/GlobalSuspense.tsx:19:11
ThemeProvider2@http://localhost:3333/node_modules/.vite/deps/chunk-LIQX2ESN.js:23:20
UIDReset@http://localhost:3333/node_modules/.vite/deps/chunk-C7D3XKWM.js:143:20
div
@http://localhost:3333/node_modules/.vite/deps/chunk-LR4KRP27.js:454:40
Styled(div)
LayersManager2@http://localhost:3333/node_modules/.vite/deps/chunk-2SBMVLQG.js:242:20
BaseProvider2@http://localhost:3333/node_modules/.vite/deps/baseui-sd.js:49:23
DevProvider@http://localhost:3333/node_modules/.vite/deps/chunk-LR4KRP27.js:181:10
div
ErrorBoundary@http://localhost:3333/node_modules/.vite/deps/react-error-boundary.js:18:10
Translator@http://localhost:3333/src/common/components/Translator.tsx:440:15
div
InnerWindow@http://localhost:3333/src/tauri/components/Window.tsx:123:15
ThemeProvider2@http://localhost:3333/node_modules/.vite/deps/chunk-LIQX2ESN.js:23:20
UIDReset@http://localhost:3333/node_modules/.vite/deps/chunk-C7D3XKWM.js:143:20
div
@http://localhost:3333/node_modules/.vite/deps/chunk-LR4KRP27.js:454:40
Styled(div)
LayersManager2@http://localhost:3333/node_modules/.vite/deps/chunk-2SBMVLQG.js:242:20
BaseProvider2@http://localhost:3333/node_modules/.vite/deps/baseui-sd.js:49:23
DevProvider@http://localhost:3333/node_modules/.vite/deps/chunk-LR4KRP27.js:181:10
ErrorBoundary@http://localhost:3333/node_modules/.vite/deps/react-error-boundary.js:18:10
Window@http://localhost:3333/src/tauri/components/Window.tsx:43:15
App@http://localhost:3333/src/tauri/App.tsx:34:82

React will try to recreate this component tree from scratch using the error boundary you provided, ErrorBoundary.
	logCapturedError (chunk-AY6FKDNS.js:14036)
	callback (chunk-AY6FKDNS.js:14082)
	callCallback (chunk-AY6FKDNS.js:10511)
	commitUpdateQueue (chunk-AY6FKDNS.js:10528)
	commitLayoutEffectOnFiber (chunk-AY6FKDNS.js:17065)
	commitLayoutMountEffects_complete (chunk-AY6FKDNS.js:17976)
	commitLayoutEffects_begin (chunk-AY6FKDNS.js:17965)
	commitLayoutEffects (chunk-AY6FKDNS.js:17916)
	commitRootImpl (chunk-AY6FKDNS.js:19349)
	commitRoot (chunk-AY6FKDNS.js:19273)
	performSyncWorkOnRoot (chunk-AY6FKDNS.js:18891)
	flushSyncCallbacks (chunk-AY6FKDNS.js:9135)
	(anonymous function) (chunk-AY6FKDNS.js:18623)
[Error] Failed to load resource: WebKit encountered an internal error (promotions.json, line 0)
[Error] Failed to load resource: WebKit encountered an internal error (promotions.json, line 0)
[Error] Failed to load resource: WebKit encountered an internal error (promotions.json, line 0)

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

[Error] Failed to load resource: WebKit encountered an internal error (promotions.json, line 0)

export async function fetchPromotions(): Promise<IPromotionResponse> {
    const resp = await fetch(
        `https://raw.githubusercontent.com/yetone/openai-translator-configs/main/promotions.json?ts=${Date.now()}`,
        { cache: 'no-cache' }
    )
    if (!resp.ok) {
        throw new Error(resp.statusText)
    }
    return resp.json()
}

Aha, openai-translator start failed for loading promotions. cc @yetone.

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

Hi, @junaire, would you like to give this fix a try? #1473

from openai-translator.

junaire avatar junaire commented on July 18, 2024

Hi, @junaire, would you like to give this fix a try? #1473

Sorry, unless I misapplied the patch, it doesn't work :(

Failed to load resource: WebKit encountered an internal error

Doesn't this imply some kind of bug of libwebkit? Which version you are using?

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

Sorry, unless I misapplied the patch, it doesn't work :(

If it doesn't work, it should have new errors like Error fetching promotions. Can you read them?

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

I try to remove the event on this butten, please give this PR a try: #1475

from openai-translator.

junaire avatar junaire commented on July 18, 2024

Sorry, unless I misapplied the patch, it doesn't work :(

If it doesn't work, it should have new errors like Error fetching promotions. Can you read them?

Yes, it has trouble loading the promotion json, but I can observe the error when the initial UI starts up too, so it's unlikely the reason.

I try to remove the event on this butten, please give this PR a try: #1475

Still exists :(

BTW, I have some new logs:

[Error] OpenFailedError: OpenFailedError
	useObservable (dexie-react-hooks.js:91)
	TranslateModeSelector (Settings.tsx:127)
	renderWithHooks (chunk-AY6FKDNS.js:12171)
	updateFunctionComponent (chunk-AY6FKDNS.js:14577)
	callCallback2 (chunk-AY6FKDNS.js:3674)
	dispatchEvent
	invokeGuardedCallbackDev (chunk-AY6FKDNS.js:3699)
	invokeGuardedCallback (chunk-AY6FKDNS.js:3733)
	beginWork$1 (chunk-AY6FKDNS.js:19761)
	performUnitOfWork (chunk-AY6FKDNS.js:19194)
	workLoopSync (chunk-AY6FKDNS.js:19133)
	renderRootSync (chunk-AY6FKDNS.js:19112)
	performSyncWorkOnRoot (chunk-AY6FKDNS.js:18870)
	flushSyncCallbacks (chunk-AY6FKDNS.js:9135)
	(anonymous function) (chunk-AY6FKDNS.js:18623)
[Error] DatabaseClosedError: UnknownError Connection to Indexed Database server lost. Refresh the page to try again
 UnknownError: Connection to Indexed Database server lost. Refresh the page to try again
	useObservable (dexie-react-hooks.js:91)
	InnerTranslator (Translator.tsx:660)
	renderWithHooks (chunk-AY6FKDNS.js:12171)
	updateFunctionComponent (chunk-AY6FKDNS.js:14577)
	callCallback2 (chunk-AY6FKDNS.js:3674)
	dispatchEvent
	invokeGuardedCallbackDev (chunk-AY6FKDNS.js:3699)
	invokeGuardedCallback (chunk-AY6FKDNS.js:3733)
	beginWork$1 (chunk-AY6FKDNS.js:19761)
	performUnitOfWork (chunk-AY6FKDNS.js:19194)
	workLoopSync (chunk-AY6FKDNS.js:19133)
	renderRootSync (chunk-AY6FKDNS.js:19112)
	performSyncWorkOnRoot (chunk-AY6FKDNS.js:18870)
	flushSyncCallbacks (chunk-AY6FKDNS.js:9135)
	(anonymous function) (chunk-AY6FKDNS.js:18623)
[Warning] There is a LayersManager already exists in your application. It is not recommended to have more than one LayersManager in an application. (chunk-YDDJB4SJ.js, line 398)
[Error] DatabaseClosedError: UnknownError Connection to Indexed Database server lost. Refresh the page to try again
 UnknownError: Connection to Indexed Database server lost. Refresh the page to try again
	useObservable (dexie-react-hooks.js:91)
	InnerTranslator (Translator.tsx:660)
	renderWithHooks (chunk-AY6FKDNS.js:12171)
	updateFunctionComponent (chunk-AY6FKDNS.js:14577)
	callCallback2 (chunk-AY6FKDNS.js:3674)
	dispatchEvent
	invokeGuardedCallbackDev (chunk-AY6FKDNS.js:3699)
	invokeGuardedCallback (chunk-AY6FKDNS.js:3733)
	beginWork$1 (chunk-AY6FKDNS.js:19761)
	performUnitOfWork (chunk-AY6FKDNS.js:19194)
	workLoopSync (chunk-AY6FKDNS.js:19133)
	renderRootSync (chunk-AY6FKDNS.js:19112)
	recoverFromConcurrentError (chunk-AY6FKDNS.js:18732)
	performSyncWorkOnRoot (chunk-AY6FKDNS.js:18875)
	flushSyncCallbacks (chunk-AY6FKDNS.js:9135)
	(anonymous function) (chunk-AY6FKDNS.js:18623)
[Error] The above error occurred in the <InnerTranslator> component:

InnerTranslator@http://localhost:3333/src/common/components/Translator.tsx:473:51
Suspense
GlobalSuspense@http://localhost:3333/src/common/components/GlobalSuspense.tsx:19:11
ThemeProvider2@http://localhost:3333/node_modules/.vite/deps/chunk-LIQX2ESN.js:23:20
UIDReset@http://localhost:3333/node_modules/.vite/deps/chunk-C7D3XKWM.js:143:20
div
@http://localhost:3333/node_modules/.vite/deps/chunk-LR4KRP27.js:454:40
Styled(div)
LayersManager2@http://localhost:3333/node_modules/.vite/deps/chunk-YDDJB4SJ.js:242:20
BaseProvider2@http://localhost:3333/node_modules/.vite/deps/baseui-sd.js:49:23
DevProvider@http://localhost:3333/node_modules/.vite/deps/chunk-LR4KRP27.js:181:10
div
ErrorBoundary@http://localhost:3333/node_modules/.vite/deps/react-error-boundary.js:18:10
Translator@http://localhost:3333/src/common/components/Translator.tsx:440:15
div
InnerWindow@http://localhost:3333/src/tauri/components/Window.tsx:123:15
ThemeProvider2@http://localhost:3333/node_modules/.vite/deps/chunk-LIQX2ESN.js:23:20
UIDReset@http://localhost:3333/node_modules/.vite/deps/chunk-C7D3XKWM.js:143:20
div
@http://localhost:3333/node_modules/.vite/deps/chunk-LR4KRP27.js:454:40
Styled(div)
LayersManager2@http://localhost:3333/node_modules/.vite/deps/chunk-YDDJB4SJ.js:242:20
BaseProvider2@http://localhost:3333/node_modules/.vite/deps/baseui-sd.js:49:23
DevProvider@http://localhost:3333/node_modules/.vite/deps/chunk-LR4KRP27.js:181:10
ErrorBoundary@http://localhost:3333/node_modules/.vite/deps/react-error-boundary.js:18:10
Window@http://localhost:3333/src/tauri/components/Window.tsx:43:15
App@http://localhost:3333/src/tauri/App.tsx:34:82

React will try to recreate this component tree from scratch using the error boundary you provided, ErrorBoundary.
	logCapturedError (chunk-AY6FKDNS.js:14036)
	callback (chunk-AY6FKDNS.js:14082)
	callCallback (chunk-AY6FKDNS.js:10511)
	commitUpdateQueue (chunk-AY6FKDNS.js:10528)
	commitLayoutEffectOnFiber (chunk-AY6FKDNS.js:17065)
	commitLayoutMountEffects_complete (chunk-AY6FKDNS.js:17976)
	commitLayoutEffects_begin (chunk-AY6FKDNS.js:17965)
	commitLayoutEffects (chunk-AY6FKDNS.js:17916)
	commitRootImpl (chunk-AY6FKDNS.js:19349)
	commitRoot (chunk-AY6FKDNS.js:19273)
	performSyncWorkOnRoot (chunk-AY6FKDNS.js:18891)
	flushSyncCallbacks (chunk-AY6FKDNS.js:9135)
	(anonymous function) (chunk-AY6FKDNS.js:18623)
[Error] Unhandled Promise Rejection: DatabaseClosedError: UnknownError Connection to Indexed Database server lost. Refresh the page to try again
 UnknownError: Connection to Indexed Database server lost. Refresh the page to try again

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

The logic about init and connect Indexed db is not implemented in openai-translator. Please try set new $HOME to /tmp and start openai?

from openai-translator.

junaire avatar junaire commented on July 18, 2024
[Log] ActionInternalService::list (action.ts, line 82)
[Log] ActionInternalService::db actions.ts:37 (action.ts, line 5)
[Log] getLocalDB db.ts:44 (db.ts, line 15)
[Log] Already have localDB, return it. (db.ts, line 21)
[Log] ActionInternalService::db actions.ts:37 (action.ts, line 5)
[Log] getLocalDB db.ts:44 (db.ts, line 15)
[Log] Already have localDB, return it. (db.ts, line 21)
[Warning] Dexie: Need to reopen db (chunk-5AGB7WI4.js, line 2126)
[Warning] Unhandled rejection: OpenFailedError: OpenFailedError (chunk-5AGB7WI4.js, line 788)
create@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:3794:46
@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:2122:21
@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:749:22
callListener@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:487:15
endMicroTickScope@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:555:22
physicalTick@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:538:45
@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:749:22
From previous: 
then@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:2759:36
list@http://localhost:3333/src/common/internal-services/action.ts:81:16
usePSD@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:734:14
newScope@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:641:18
execute@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:2490:64
doQuery@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:2524:26
@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:2547:12
@http://localhost:3333/node_modules/.vite/deps/dexie-react-hooks.js:73:50
commitHookEffectListMount@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:16904:40
commitPassiveMountOnFiber@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18152:44
commitPassiveMountEffects_complete@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18125:42
commitPassiveMountEffects_begin@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18115:49
commitPassiveMountEffects@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18105:42
flushPassiveEffectsImpl@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:19486:36
flushPassiveEffects@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:19443:45
commitRootImpl@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:19412:32
commitRoot@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:19273:27
performSyncWorkOnRoot@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18891:21
flushSyncCallbacks@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:9135:38
@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18623:39
From previous: 
resolve@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:2844:34
enterTransactionScope@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:2111:30
list@http://localhost:3333/src/common/internal-services/action.ts:81:16
usePSD@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:734:14
newScope@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:641:18
execute@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:2490:64
doQuery@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:2524:26
@http://localhost:3333/node_modules/.vite/deps/chunk-5AGB7WI4.js:2547:12
@http://localhost:3333/node_modules/.vite/deps/dexie-react-hooks.js:73:50
commitHookEffectListMount@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:16904:40
commitPassiveMountOnFiber@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18152:44
commitPassiveMountEffects_complete@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18125:42
commitPassiveMountEffects_begin@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18115:49
commitPassiveMountEffects@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18105:42
flushPassiveEffectsImpl@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:19486:36
flushPassiveEffects@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:19443:45
commitRootImpl@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:19412:32
commitRoot@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:19273:27
performSyncWorkOnRoot@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18891:21
flushSyncCallbacks@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:9135:38
@http://localhost:3333/node_modules/.vite/deps/chunk-AY6FKDNS.js:18623:39

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

Hi, @junaire, I submit a PR to print errors while open indexeddb failed: #1478. Please give it a try and share the error message.

from openai-translator.

junaire avatar junaire commented on July 18, 2024

Hi, @junaire, I submit a PR to print errors while open indexeddb failed: #1478. Please give it a try and share the error message.

Hi, thanks for your effort! I tried your PR but the console outputs nothing :( I also tried to use try catch clauses to see if I could catch some exceptions, but sadly no. From the logs in the console, this group of call stack ActionInternalService::list -> ActionInternalService::db -> getLocalDB at least appears 4 times, and the first time it has no errors, but the last time I can observe warnings like Dexie: Need to reopen db and Unhandled rejection: OpenFailedError: OpenFailedError then it throws OpenFailedError: OpenFailedError.

By stepping into the backtrace of the Dexie: Need to reopen db I can see code like:

      try {
        trans.create();
        db._state.PR1398_maxLoop = 3;
      } catch (ex) {
        if (ex.name === errnames.InvalidState && db.isOpen() && --db._state.PR1398_maxLoop > 0) {
          console.warn("Dexie: Need to reopen db");
          db._close();
          return db.open().then(() => enterTransactionScope(db, mode, storeNames, null, scopeFunc));
        }
        return rejection(ex);
      }

This looks so weird like they have some retry logic? and we indeed triggered this 3 times, then it fails. BTW, last time I somehow debugged err.inner.message is exactly connection to indexed database server lost. refresh the page to try again, which implies nothing...

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

This looks so weird like they have some retry logic? and we indeed triggered this 3 times, then it fails. BTW, last time I somehow debugged err.inner.message is exactly connection to indexed database server lost. refresh the page to try again, which implies nothing...

really weird. Can you inspect the indexeddb in devtools? Anything special?

from openai-translator.

junaire avatar junaire commented on July 18, 2024

Yes, that's really weird. Here is my side:

image

Seems indexeddb in your webkit doesn't work well.

Please try the following js in devtools:

let db;
const request = indexedDB.open("MyTestDatabase");
request.onerror = (event) => {
    console.error("Why didn't you allow my web app to use IndexedDB?!");
};
request.onsuccess = (event) => {
    console.info("Load success");
    db = event.target.result;
};
db.close()

Yes, I can confirm we can't use indexeddb.
image
image

FYI, I created a demo tauri app, tried the code above, and everything works just fine.

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

Does indexeddb work correctly on your own browser (chromium based) correctly? You can use the same scripts.

from openai-translator.

junaire avatar junaire commented on July 18, 2024

Does indexeddb work correctly on your own browser (chromium based) correctly? You can use the same scripts.

Yes, it's good.

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

I tried to replace the URL to www.example.com and returned {} the bug still reproduces.

Does fetch return 'ok'? Or does the indexeddb break regardless of what fetch returns, as soon as we call it?

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

I added fetch promotions in https://github.com/Xuanwo/tauri-indexeddb-openfailed, would you like to give it a try?

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

It even failed to connect to my local server created by python3 -m http.server , but with a slightly different error message Connection terminated unexpectedly

That's really weird. Do you have http proxy settings or something? Try cleanup them all and try again.

from openai-translator.

Xuanwo avatar Xuanwo commented on July 18, 2024

But I still don't know how proxy settings affect indexed db. Would you like to share your settings you are using?

from openai-translator.

junaire avatar junaire commented on July 18, 2024

But I still don't know how proxy settings affect indexed db. Would you like to share your settings you are using?

I'm using clash of Windows, a legacy version.
image

from openai-translator.

junaire avatar junaire commented on July 18, 2024

OK, I'd like to close the issue since it's only about my local config. Still, I don't understand how can proxy settings affect the behavior of fetch, then affect the behavior of indexeddb. Maybe there're some further bugs in webkit or something but that's another story. Anyway, I'm glad that we finally get there and many thanks to @Xuanwo! <3

from openai-translator.

boundless-forest avatar boundless-forest commented on July 18, 2024

@junaire @Xuanwo I have the same issue today, how do you solve it in the end?

from openai-translator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.