tweb icon indicating copy to clipboard operation
tweb copied to clipboard

[BUG] Using local ip access produces Uncaught ReferenceError: caches is not defined?

Open yyidota opened this issue 2 years ago • 2 comments

Describe the bug After modifying the local IP access, the console reports "mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:3498 Uncaught ReferenceError: caches is not defined",I tried to replace localhost with my local ip, and the WORKER ERROR was triggered. To Reproduce Steps to reproduce the behavior:

  1. Modify the start command in package.json
  2. Add --host=0.0.0.0 to start the service, "start": "node --max-old-space-size=12048 node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.dev.js --host=0.0.0.0",
  3. View Google Chrome Console
  4. See error

Expected behavior Console no longer outputs WORKER ERROR, mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:3498 Uncaught ReferenceError: caches is not defined

Screenshots image

Desktop (please complete the following information):

  • OS: [windows10]
  • Browser [chrome]
  • Version [100.0.4896.127]

Additional context [0.486] [API-PROXY] [] WORKER ERROR ErrorEvent {isTrusted: true, message: 'Uncaught ReferenceError: caches is not defined', filename: 'http://172.16.8.12:8080/mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js', lineno: 3498, colno: 97, …} log. @ main.25e98fec5c15d2729bd6.bundle.js:92538 @ main.25e98fec5c15d2729bd6.bundle.js:93266 error registerWorker @ main.25e98fec5c15d2729bd6.bundle.js:93265 ApiManagerProxy @ main.25e98fec5c15d2729bd6.bundle.js:93167 ./src/lib/mtproto/mtprotoworker.ts @ main.25e98fec5c15d2729bd6.bundle.js:93535 webpack_require @ main.25e98fec5c15d2729bd6.bundle.js:64 ./src/lib/langPack.ts @ main.25e98fec5c15d2729bd6.bundle.js:91691 webpack_require @ main.25e98fec5c15d2729bd6.bundle.js:64 ./src/index.ts @ main.25e98fec5c15d2729bd6.bundle.js:66237 webpack_require @ main.25e98fec5c15d2729bd6.bundle.js:64 0 @ main.25e98fec5c15d2729bd6.bundle.js:100732 webpack_require @ main.25e98fec5c15d2729bd6.bundle.js:64 @ main.25e98fec5c15d2729bd6.bundle.js:144 @ main.25e98fec5c15d2729bd6.bundle.js:147 mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:3498 Uncaught ReferenceError: caches is not defined at CacheStorageController.openDatabase (mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:3498:97) at new CacheStorageController (mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:3493:14) at new ApiFileManager (mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:5231:29) at Module../src/lib/mtproto/apiFileManager.ts (mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:5750:24) at webpack_require (mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:20:30) at Module../node_modules/ts-loader/index.js!./node_modules/ifdef-loader/ifdef-loader.js?!./src/lib/mtproto/mtproto.worker.ts (mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:1924:73) at webpack_require (mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:20:30) at mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:84:18 at mtproto.worker.62fa4c2af74d47fd0011.bundle.worker.js:87:10

yyidota avatar Apr 24 '22 06:04 yyidota

Same error. Do you solved that?

ti-bone avatar Jul 31 '22 23:07 ti-bone

After doing some research, I find out that: Chrome and Safari only expose CacheStorage to the windowed context over HTTPS (Ref: https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage), so it's failed since I've not setup HTTPS yet.

I consider this as a bug since I always test the functionality of the service before doing some advanced kinds of stuff (reverse proxy, https...etc), so I think it's abnormally to have this error and hope this can be fixed.

BeTure20 avatar Sep 15 '22 17:09 BeTure20

In order to host it, you have to use HTTPS, otherwise app won't work. You can use self-signed certificate (although some functions still won't work).

morethanwords avatar Jan 13 '23 08:01 morethanwords