ItsWendell
Explore posts from serversGlobal metadata / filters: Re-validate all queries
Hi all,
Simple question, I'm looking for the most efficient way to add some global state to all queries, in this case it's a global filter, for this use-case, let's call it
testModeFilter
. In our dashboard this could be a Context / Provider that manages this state, ideally, when testModeFilter, we want to:
1. invalidate all queries / refetch mounted queries
2. Make sure this global filter / metadata is passed to the server 'somehow'
What's the best approach for this? E.g. I was thinking possibly a cookie, or a header but was wondering if there's other ways to sent global metadata with every query / mutation.4 replies
CDCloudflare Developers
•Created by ItsWendell on 8/17/2023 in #workers-help
Sending multipart/mixed form data in Workers
With the
form-data
node package you can define content types / headers per item in the form, see example.
I'm trying to conform to the following spec: https://docs.expo.dev/technical-specs/expo-updates-1/#multipart-response
Any tips on how to achieve this in Workers?4 replies
Deduping is broken, but is being batched
Hi all,
We're using TRPC for our React Native app, while doing some testing, I saw in my server logs that the requests don't seem to be deduplicated on the client side, but are batched to the server.
Here you can see that these requests are being made twice, this is for one active client, not sure why this is or if this is due potentially React Query.
Versions being used: 10.37.1 for client / server
React Query: ^4.32.6
What could this possibly be? Here's our TRPC Provider (combined some of the files):
4 replies
CDCloudflare Developers
•Created by ItsWendell on 5/26/2023 in #workers-help
Deployment Error: workers.api.error.placement_and_triggers_configured (100150)
Hi all!
I'm suddenly getting the following error when trying to deploy an worker, as the error might indicate, we do have placements set to smart and we have a queue consumer / producer set in the same worker. I feel like this didn't happen before and wonder what changed, and if it's not possible to have smart placements enabled with queue consumers / producers?
56 replies
CDCloudflare Developers
•Created by ItsWendell on 5/20/2023 in #workers-help
KV Assets (site bucket) __STATIC_CONTENT is are suffixed with hashes (05c5fa8db8)
Hi all,
We're trying to use a workers sites bucket defined in our API wrangler to host some (temporary) image assets in to show in our app, but once we attempt to fetch these we see that they are suffixed with hashes. What is the recommended way to continue here so we can access assets in these buckets through e.g.
/public/some-temp-image.png
? We use getAssetFromKV:
Can we skip workers sites from adding these hashes?5 replies
CDCloudflare Developers
•Created by ItsWendell on 5/20/2023 in #general-help
One email, multiple accounts?
Hi all!
A friend is trying to invite me to an Cloudflare account he recently made so we can work together on a project in there (Workers, etc). He sent me an invite on an email address I already have registered at Cloudflare but I haven't received any emails. He now tried to delete and add me so many times that he got rate limited and needs to wait for an hour.
I was wondering whether it's even possible to have multiple accounts / organizations connected to a user?
8 replies
TypeScript, Mono-Repositories and Internal Packages / Project References
I am getting quite frustrate with project references / internal projects and the resolving of types for TypeScript. To make it a bit smaller, let's say I have
@acme/api-service
which exports TRPC types and a Cloudflare Worker, I also have @acme/app
which wants to consume this api service's TRPC types.
In @acme/api-service
I am exporting main / types fields in package.json
, I am also using path aliases, and defining global types for it's environment in compilerOptions.types
in tsconfig.json.
When I don't use project references, and I run tsc --noEmit
for type checking in the @acme/app folder I get errors about the missing global types, and the path aliases. When I use project references it seems like that kind of fixes it, but it looks like I need to continuously watch / build the declaration files of @acme/api-service
while in development to not get these types out of sync.
What is a good solution here, can I make sure that tsc reads the aliases / types from the tsconfig file from @acme/api-service
?
I am looking for a good setup for this scenario, where I can properly type check the whole mono repo during CI / CD, and making sure that the IDE stays fast since our repository is getting quite big.4 replies
Proxy TRPC server to another client
I've two TRPC servers, one essentially acts like a proxy, it validates auth and based on a specific property it forwards you to the destined server (with that one property removed).
Now I have to write all those queries and mutation twice, is there a simpeler way to do this? Is there any way to bind a specific TRPC client to a server?
8 replies
Sharing middleware between TRPC servers
We currently have microservices REST API's on Cloudflare Workers and I'm thinking about moving this to TRPC Microservices.
We currently have a middleware in a shared package that we can reuse between microservices for authentication, how do I do this within TRPC?
How do I define a
MiddlewareFunction
that can be reused between multiple TRPC instances?2 replies