Error occuring: Uncaught ReferenceError: FinalizationRegistry is not defined
Opened this issue · 6 comments
Hi
After resolving this issue I ran into the next one. My barebones worker throws the exception:
⛅️ wrangler 2.10.0
--------------------
Your worker has access to the following bindings:
- Vars:
⬣ Listening at http://0.0.0.0:8787
- http://127.0.0.1:8787
- http://192.168.43.230:8787
Total Upload: 223.96 KiB / gzip: 62.20 KiB
✘ [ERROR] Error on remote worker: ParseError: A request to the Cloudflare API (/accounts/e18730c578d8a62bbaf31c7a65b3344f/workers/scripts/script-name/edge-preview) failed.
at throwFetchError
(/Users/.../node_modules/wrangler/wrangler-dist/cli.js:123634:17)
at fetchResult
(/Users/.../node_modules/wrangler/wrangler-dist/cli.js:123603:5)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async createPreviewToken
(/Users/.../node_modules/wrangler/wrangler-dist/cli.js:125631:29)
at async createWorkerPreview
(/Users/.../node_modules/wrangler/wrangler-dist/cli.js:125651:17)
at async start
(/Users/.../node_modules/wrangler/wrangler-dist/cli.js:128131:34)
{
text: 'A request to the Cloudflare API
(/accounts/e18730c578d8a62bbaf31c7a65b3344f/workers/scripts/script-name/edge-preview)
failed.',
notes: [
{
text: 'Uncaught ReferenceError: FinalizationRegistry is not defined\n' +
' at index.js:342:28\n' +
' [code: 10021]'
}
],
location: undefined,
kind: 'error',
code: 10021
}
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [l] turn on local mode, [c] clear console, [x] to exit │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
It seems to relate to this issue which basically says "not supported".
So can I conclude that this package here doesn't work and it is not possible to connect to MySQL from a Cloudflare Worker?
Edit: To clarify, it seems that this error is originating from the wasm of this package.
Same issue.
service core:user:database-connection-test: Uncaught ReferenceError: FinalizationRegistry is not defined
at worker.js:360:28
X [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
Have you guys figured out this issue yet? @FirokOtaku @Badestrand
@roshanjonah Not yet. This demo project is inactive for 2 years and seems won't be re-active. I just gived up and searched for other solutions.
For connecting MySQL and Postgres databases, the word "deno" is mentioned in Cloudflare document and I'm not sure whether this Deno is the one we needed. Recently I'm working on other project and have no time to test with it. If you are interested you could try it.
Or perhaps we could just go back to the original solution: write a backend server software, for a serverless service. 🤣🤣
@FirokOtaku Thanks for the reply. Definitely not writing my own service 🤣
I am thinking of trying https://github.com/brettscott/cloudflare-worker-tunnel-mysql-example - seems like it is working for some people - fingers crossed - let's see how it goes.
@roshanjonah BTW, if your goal is to "connect to database" and is not limited to MySQL database, using a database with built-in RESTful API support might be a solution too. For example, MongoDB and ElasticSearch.
@FirokOtaku Unfortunately, our requirement is the opposite. We already have a client DB (MySQL - externally hosted) and need to connect to it using Cloudflare workers. We can't seem to do it even with the Cloudflare tunnel setup. Therefore, I am waiting for an update from either Cloudflare or see if there are workarounds online.