kgni
Explore posts from serversSentry - hono/trpc/cloudflare workers
"Since Cloudflare workers run on the v8 engine, I'm assuming I can just use the sentry/browser package in my workers."Well just found out that toucan-js is the sentry client for CF workers. First issue solved :1012tick:
2 replies
tRPC context, NeonDB & WebSockets
Well, I spoke with a guy that works at neon, and he made me aware that "The pool is initially created empty and will create new clients lazily as they are needed.", so all of this is not necessary 🙃 The only thing I need in my case is to have a middleware that closes/ends the pool after the response.
15 replies
tRPC context, NeonDB & WebSockets
With this implementation, wouldn't it always be open, which I don't want.. sorry for not being clear enough
per neondb documentation it is advised to close the db connection after every response. So I want to open it when I need it (only in specific procedures) and close it after it is done
15 replies
tRPC context, NeonDB & WebSockets
Ah I see, so you could technically split it up as follows:
1. Create the Websocket database instance in a middleware and then pass it to the context - instead of creating it directly in the context (you could also close the pool in the middleware then).
2. Recreate all of your procedures, so that you have 2 different types - 1 that utilizes HTTP and 1 for websockets, for example:
- publicProcedure, protectedProcedure (both just have the HTTP database instance)
- publicProcedureWebSocketets, protectedProcedureWebSockets.
Would that be a way of doing it to avoid opening the websocket connection every single time the context is created? Also, would there be a smarter way of doing this, than to recreate all of the procedures with websockets (seems a bit too repetitive and redundant)
15 replies
tRPC context, NeonDB & WebSockets
I'm using the neon serverless driver to create a drizzle client which connects over websockets, I just don't know if this connection will open everytime the context is created. I don't want that to happen when/if I'm only querying the database over HTTP.
I hope I'm making sense.
Essentially I have:
2 different db clients created in context.
As far as I know context is created every time a procedure runs. So if I create a client with a pool like this:
Then the connection would technically open every time the context is created right? Or is it only when I'm actually using the client?
I want the connection to only open when it is used and not when context is created.
15 replies
CDCloudflare Developers
•Created by kgni on 2/5/2024 in #workers-help
wrangler.toml config questions
3. how to sync staging and local
I want to keep my local and staging environment in sync when developing. Is it possible to dump the staging data? Does anyone have a suggestion how to obtain this in the best way?
So far my pipelines are going to run the migrations and deploy the workers depending on merge to staging or production branch, but I also want to be able to pull the staging environment into my local environment
To answer this 3rd question myself, I guess for now you can create a backup using of the desired environment using this and just seed from that locally?
reference: https://github.com/cloudflare/workers-sdk/issues/3891
3 replies