Cloudflare Developers

CD

Cloudflare Developers

Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news

Join

Use getAssetFromKV with subdomain

Hi I am trying to use getAssetFromKV with a subdomain. I have it configured in my wrangler.toml ``` routes = [ { pattern = "mydomain.app", custom_domain = true },...

Deployment via GH Action sometimes gives error about NPX failing with "exit code 1"

I have auto-deployment set up via the Wrangler GH action. Normally when I push my deployments go through fine, but every now and then (twice today) I get the below. Sometimes if I re-run the job (from the GH side), it runs successfully; other times, like today, re-running the jobs brings the same error again. Over on the CF side, under Deployments, it seems to think the deployment did succeed. It says the active deployment was "a few seconds ago". But this is not true; a check of the code (via the CF > Workers dashboard) shows the changes didn't come through, so the workflow error did indeed stop the deployment. Why does this happen?...
No description

When will cloudflare d1 replication be implemented?

It seems cloudflare d1 replication hasn't been implemented yet. Is it in progress or when can we expect it to be functional?

Is it possible to make a Discord Bot with Worker

Ollo :Wave: smart people of Cloudflare. So, I'm a very new to this. But when I learned about Cloudflare's Worker service (PYTHON). The first thing that popped into my head was
I need to make a Discord Bot using this
...

Context Enricher Worker not work

I created a worker to enrich zaraz context following official example, but it didn't work as expected. Inspecting the "Real time logs", it never get called. https://developers.cloudflare.com/zaraz/advanced/context-enricher/#adding-arbitrary-information-using-an-api...

Cannot read properties of undefined (reading 'fetch') with Node

I'm getting this with just running a basic command of @cloudflare/puppeteer that I got from the docs Here's the docs https://developers.cloudflare.com/browser-rendering/platform/puppeteer/#use-puppeteer-in-a-worker...
No description

Worker RPC host logs aren't showing up

I'm experimenting with workers RPC and logs from RPC "host" don't get pushed, but show up in wrangler tail. Is there a known limitation around RPC and logpush? Higher-level problem I'm trying to solve is log tracing when multiple workers are involved in a flow. I was assuming RayID would be equal for the worker invoked with fetch and the one called via RPC, but RPC host logs aren't showing up at all 😅...

CF as my backend. How to solve auth for mobile apps?

I am building a mobile app and I'd like to use CF as my backend. So I wanna use Workers, D1 and so on. The frontend is a Flutter app. My problem: How can I solve the auth problem? My initial plan was to use Firebase Auth and then use the Firebase admin sdk to verify a user within a worker. Sadly the Firebase admin sdk is not edge compatible. How would you solve this problem? I want to use multiple auth flows (Apple, Google, Mail). Authjs has a core package which can be used in CF Workers but it is still experimental.....

[VERY EXTREMELY CURSED] How can I access process.env (at start time)

Ahoy! I need .env to instantiate my jwt server. I've spent so much time of my life reading minified code and dealing with build tools, BUT I HAVE NO IDEA WHATS GOING ON!!! Solid start somehow uses vite, rollup, esbuild, vinxi, and nitro. and then I suppose cf is doing its own polyfills Has javascript gone too far???? But anyway My first attempt is ```ts...

How to make a request to a Zero Trust Access protected endpoint via a worker?

We are trying to make a request to a cloudflare access protected endpoint in a worker. We own the endpoint, and we've set up a Service Auth key and secret, and we're setting the CF headers on the HTTP Client. It appears that the headers are being stripped from the HTTP Client in the worker context, and it just 302's us to the Access page. Is there any documentation to help us with this? Cloudflare Support says that stripping the headers is correct behaviour, so is there an alternative method to making HTTP requests to a Cloudflare Access protected endpoint from a Cloudflare worker that hasn't been documented?...

Env Vars in Worker

Hi, I am having an issue using an environment variable in my Worker code. I have set the environment variable in my Worker's dashboard, and am trying to access it in my Worker JS code, but it won't work. When I console log the env var it either shows up as 'Null' or 'Cannot read properties of undefined'. I have tried to simplify my code to see if I can pinpoint the issue, but am not sure what I'm doing wrong. Is it necessary to use a Wrangler file, or am I implementing it incorrectly? `addEventListener('fetch', event => {...

Workers for platforms or standard

I want to manage a lot of domains (few hundred) and each one of them will have their own worker. Each of the workers will do a small API Request to another platform and i also want to save the visitors country, data, headers etc to a database. What would suit me better workers paid or workers for platforms? If i understood it good Workers for platforms is now available for non enterprise customers too. Is there also a limit for workers for platforms of 500 the same like for the workers paid and any other limits and also which database would you recommend for this D1, hyperdrive or? Btw i have my own simple dashboard for cloudflare API. Thank you very much for your help....

Workers with itty-router throws an error

Hello! I'm trying to use itty-router in a worker. However, an error is showing when I try to get a path. ``` X [ERROR] A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished. ...

Proxy'ing google docs document

```js export default { async fetch(request, env, ctx) { // URL of the Google Doc (make sure it's shareable and publicly accessible) const googleDocUrl = 'https://docs.google.com/document/d/doc-id/view';...
No description

Connect Shopify with cloudflare and use Workers.

Hi everyone, I'm looking for some advice on enabling a proxy for a Shopify website. We're running a small site and don't want to invest in the Enterprise Plan just to get this feature. How can I do it? Are there any alternative solutions or workarounds to enable a proxy on Shopify without upgrading to the Enterprise Plan? Any insights or experiences you can share would be greatly appreciated....

Upload JSON object to KV

Is it possible to update KV using a local JSON file? My idea would be to update the file locally and call the enpoint kv.put to update the KV entries...

can't deploy example

until now I've used the github integration, but I wanted to start a mono-repo and created a dummy project using pnpm create cloudflare. unfortunatelly wrangler login gets stuck on consent and when trying an API token it just says I don't have the correct permissions (very unuseful) wrangler login gets stuck on the consent page, maybe related to a this CORS error? ```...

Connect to postgres from Workers through tunnel. Is it still possible?

https://blog.cloudflare.com/introducing-socket-workers https://github.com/cloudflare/worker-template-postgres Based on this blog post and the template on github, it looks like they used a custom driver to accomplish that. However, the blog and repository were last updated three years ago, and I think things have changed a lot now. I tried running this sample, but the dependencies were old (wrangler v1) and I didn't know how to migrate them....