Connect to Redis on Cloudflare Workers

I'm getting this error when trying to connect to a simple redis instance:
"TypeError: Class extends value undefined is not a constructor or null\n at node_modules/@redis/client/dist/lib/client/socket.js (bundledWorker-0.5853845851870065.mjs:53957:46)\n at __require (bundledWorker-0.5853845851870065.mjs:37:51)\n at node_modules/@redis/client/dist/lib/client/index.js (bundledWorker-0.5853845851870065.mjs:57012:20)\n at __require (bundledWorker-0.5853845851870065.mjs:37:51)\n at node_modules/@redis/client/dist/index.js (bundledWorker-0.5853845851870065.mjs:58651:20)\n at __require (bundledWorker-0.5853845851870065.mjs:37:51)\n at node_modules/redis/dist/index.js (bundledWorker-0.5853845851870065.mjs:62787:20)\n at __require (bundledWorker-0.5853845851870065.mjs:37:51)\n at .svelte-kit/output/server/entries/endpoints/graphql/_server.ts.js (bundledWorker-0.5853845851870065.mjs:64226:28)\n at __init (bundledWorker-0.5853845851870065.mjs:34:56)"
"TypeError: Class extends value undefined is not a constructor or null\n at node_modules/@redis/client/dist/lib/client/socket.js (bundledWorker-0.5853845851870065.mjs:53957:46)\n at __require (bundledWorker-0.5853845851870065.mjs:37:51)\n at node_modules/@redis/client/dist/lib/client/index.js (bundledWorker-0.5853845851870065.mjs:57012:20)\n at __require (bundledWorker-0.5853845851870065.mjs:37:51)\n at node_modules/@redis/client/dist/index.js (bundledWorker-0.5853845851870065.mjs:58651:20)\n at __require (bundledWorker-0.5853845851870065.mjs:37:51)\n at node_modules/redis/dist/index.js (bundledWorker-0.5853845851870065.mjs:62787:20)\n at __require (bundledWorker-0.5853845851870065.mjs:37:51)\n at .svelte-kit/output/server/entries/endpoints/graphql/_server.ts.js (bundledWorker-0.5853845851870065.mjs:64226:28)\n at __init (bundledWorker-0.5853845851870065.mjs:34:56)"
How can I simply connect to Redis on my Cloudflare instance? My code is simple: https://github.com/jdgamble555/redisgraph-graphql-sveltekit/blob/master/src/lib/server/redis.ts How can I get this to work? J
GitHub
redisgraph-graphql-sveltekit/redis.ts at master · jdgamble555/redis...
Contribute to jdgamble555/redisgraph-graphql-sveltekit development by creating an account on GitHub.
3 Replies
James
James2y ago
You can’t really do this today outside of some kind of http adapter for redis, like upstash. Socket workers will allow you to do this soontm
jdgamble555
jdgamble555OP2y ago
What are socket workers? Will this allow me to connect to http? Where do I find them?
James
James2y ago
They’re not something you can use yet, but soon. https://blog.cloudflare.com/introducing-socket-workers/
The Cloudflare Blog
Making connections with TCP and Sockets for Workers
The ability to make TCP and QUIC client connections from within Workers and Durable Objects, as well as the ability to connect to Workers over TCP and QUIC without using HTTP, will be coming to Cloudflare Workers. Here’s a peek at what we’re working on.
Want results from more Discord servers?
Add your server