ex0ns
ex0nsā€¢5mo ago

typescript client in cloudflare workers

I was using wmill typescript client from my cloudflare workers but it stopped working today:
āœ˜ [ERROR] service core:user:my-app: Uncaught ReferenceError: process is not defined
cloudflare-backend:dev:
cloudflare-backend:dev: at null.<anonymous> (index.js:649:9) in getEnv
cloudflare-backend:dev: at null.<anonymous> (index.js:653:32) in
cloudflare-backend:dev: ../../node_modules/.pnpm/windmill-client@1.335.0/node_modules/windmill-client/dist/core/OpenAPI.js
cloudflare-backend:dev: at null.<anonymous> (index.js:11:50) in __require
cloudflare-backend:dev: at null.<anonymous> (index.js:7960:21) in
cloudflare-backend:dev: ../../node_modules/.pnpm/windmill-client@1.335.0/node_modules/windmill-client/dist/index.js
cloudflare-backend:dev: at null.<anonymous> (index.js:11:50) in __require
cloudflare-backend:dev: at null.<anonymous> (index.js:31929:21)
cloudflare-backend:dev:
āœ˜ [ERROR] service core:user:my-app: Uncaught ReferenceError: process is not defined
cloudflare-backend:dev:
cloudflare-backend:dev: at null.<anonymous> (index.js:649:9) in getEnv
cloudflare-backend:dev: at null.<anonymous> (index.js:653:32) in
cloudflare-backend:dev: ../../node_modules/.pnpm/windmill-client@1.335.0/node_modules/windmill-client/dist/core/OpenAPI.js
cloudflare-backend:dev: at null.<anonymous> (index.js:11:50) in __require
cloudflare-backend:dev: at null.<anonymous> (index.js:7960:21) in
cloudflare-backend:dev: ../../node_modules/.pnpm/windmill-client@1.335.0/node_modules/windmill-client/dist/index.js
cloudflare-backend:dev: at null.<anonymous> (index.js:11:50) in __require
cloudflare-backend:dev: at null.<anonymous> (index.js:31929:21)
cloudflare-backend:dev:
I think that the commit that broke this is https://github.com/windmill-labs/windmill/pull/3714/files#diff-13bcd4e9fc2a785250e31b9122dbedeacc95fe47601feeb1169a0da8c84917a6R8 Before this commit, the lookup in the env was not performed in case the setClient method was called, and in CF Workers, process is not something that exists Do you have a workaround to make wmill typescript client work from Cloudflare workers ?
7 Replies
rubenf
rubenfā€¢5mo ago
we would just need to check for the existence of process
rubenf
rubenfā€¢5mo ago
but need to check a few things to confirm it works in all runtimes could you check that works well in the cf runtime?
ex0ns
ex0nsā€¢5mo ago
I have tested locally (using wrangler, so it should be as close as possible to the real runtime), and globalThis?.process is indeed working
rubenf
rubenfā€¢5mo ago
great thanks, I just have to test it works well with bun,deno,nodejs and nativets and will merge
ex0ns
ex0nsā€¢5mo ago
By working I mean not crashing anymore. But I can't test other runtime right now
rubenf
rubenfā€¢5mo ago
šŸ‘ thanks for the report!