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 Server
SScarabCoder1/18/2024

Too many redirects when making fetch requests from a worker

When I make a fetch request from a CF Worker, I'm getting a "Too many redirects" error from the fetch. The redirect URLs aren't changing, each new location is the same URL as the previous. This only happens when making requests to the same domain that the worker lives on (different subdomain). When making a request manually from my device, there are no redirects. It happens with any URL on the same CF domain. For example, if my CF worker lives on worker.example.com. When I use fetch in the Worker to make a request to https://api.example.com/somepath, the Fetch errors out with an infinite redirect, where each redirect location is https://api.example.com/somepath. I can make manual requests to https://api.example.com/somepath from my device and do not see any redirects....
AAvocadio1/18/2024

can not open my domain in chrome but i can in safari

it is really weird. when i send http request it returns correct website. in chrome or in my phone's safari domain does not works is there a kind of cache or something that does not make sense
Bbllmo1/18/2024

Multiple Worker API Gateway Architecture

I am seeking guidance on best practices and a sample repository that can help me understand how to properly set up a project with multiple workers responding to a single API gateway, like api.example.com. Specifically, I want to use different workers for different endpoints, directing /files to worker_1 and /jobs to worker_2. Additionally, I need to implement rate limiting and authentication for these services. How can I effectively organize and configure this project using Wrangler to include t...
SSami1/18/2024

Error: internal error when replied to a get request with websocket upgrade headers with a websocket

In one of my subdomains, I am redirecting a post request containing websocket upgrade headers to another subdomain with 303 response and returning a websocket response from redirected url with
return new Response(null,{status:101,webSocket:client});
return new Response(null,{status:101,webSocket:client});
where code is essentially the example in the docs, websockets are created with WebSocketPair() However, after I return the response I am getting an Error: internal error on wrangler tail and 400 Bad request from client. Any suggestions on what to how to figure out what is wrong or debug? I tried to add try-catch to outermost layer that I have access to and it doesn't catch anything. Thanks!...
SSami1/18/2024

Is there an example to create a websocket with a DO for an http/2 request?

I am trying to create and return a websocket to a specific request but if the request is made with http/2 I don't see Upgrade headers in the request. Is there an example of how to use websockets with http/2?
Eesdee1/17/2024

Anyone have a n example of Validating Cf-Access-Jwt-Assertion from a worker

The JS example in the docs https://developers.cloudflare.com/cloudflare-one/identity/authorization-cookie/validating-json/ uses npm libraries, which means I have to use node_compat = true in wrangler.toml Are they any examples that do not require this?...
MMitya1/17/2024

Does anyone have a working example of evaluating JavaScript via WASM?

(This is a spin-off from this thread, which ultimately asks a different question and has become quite lengthy.) I need to evaluate some JavaScript, but understand that eval() / new Function() is blocked on workers. I understand my only route to evalulation is via WASM. But I'm struggling to implement a working example of JS evaluation via WASM in Workers. I'm completely new to WASM and am focusing on packages that do the heavy lifting for you. Here's what I've tried, using quickjs-emscripten:...
LPLost Pages1/17/2024

change pages functions watch directories in wrangler

When running pages functions locally wrangler watches only the functions directories. Is there a way to make it watch other directories too?
Cconstant18941/17/2024

Cannot set content type for video upload

Hi Everyone! I cannot seem to set the content type of a video I'm uploading. I have set the content type in the header, but it doesn't work. This is what I see in the dashboard....
No description
DDilshad1/17/2024

Missing entry-point

I have created a wrangler project using the Worker Get Started guide. Now when I run npx wrangler dev it gives the following error. [See attachment] In /wrangler.toml the main has the following value [See attachment]...
No description
Ppelikann19921/16/2024

HELP configuration all firewall

please add DNS guard virus scan alll DDOS all configuration please
No description
FF0rce1/16/2024

Debugging SSR Page

What is the best way to debug a 1101 Error and tail says Error: The script will never return a response. For context we are hosting an astro site with SSR as a "sandbox" environment for customers to test CMS changes before deploying (the final page is static). But for some "some minutes - minutes could also last for 20-25 minutes" the page works perfeclty fine and then for a long time there is the 1101 Error and I really cant find a way to debug, etc. Any help / direction would be really appreci...
Mmichmich1/16/2024

Cannot access `wrangler dev --ip 0.0.0.0` from local network

I used to be able to access http://192.168.1.26:8787 from my phone connected to the same wifi network. (i can access other ports, if I run a simple web server for example) Today it does not work anymore... I tried upgrading/downgrading wrangler version, nothing changed. ...
Sskelet0r281/16/2024

Zaraz: Custom Managed Component Worker Request Always Cancelled

I'm trying to set up a custom managed component that sets up logrocket analytics, but the request is always cancelled. I'm not sure what I'm doing wrong as there is nothing in the logs that indicates why the request might get cancelled. Is there a good example of setting up a third party analytics tool using zaraz?
No description
MMitya1/16/2024

How can I enable support for `eval()` in Workers?

Yes yes I know all the caveats about eval() but it's essential for my use-case. When running in dev mode (but with --remote i.e. running on CF architecture) I get:
EvalError: Code generation from strings disallowed for this context
EvalError: Code generation from strings disallowed for this context
I've read this but didn't fully understand what to action from it. Could someone please advise? Thank you!...
Kkend79341/16/2024

Need help deleting R2 objects

I'm using Microfeed (https://github.com/microfeed/) to add objects to R2. Microfeed, which is intended as a publishing tool for individual podcasters, does not include a way to delete objects and the author argues coherently against deletion, but my use case is different. I'm allowing users of my app to upload some large objects that they may want to delete. So I installed Wrangler and somehow got the authentication to work, and was able to issue a command to delete an object which looks as if it worked. At the command line I did:...
Uuk1/16/2024

Worker failing mysteriously with exceeded CPU time limit.

I'm trying to run this minimal worker: ```js // Worker export default {...
Sscefali1/15/2024

Can't enable analytics engine

Getting a 500 error trying to enable the analytics engine for my account. It's hitting the endpoint: https://dash.cloudflare.com/api/v4/accounts/<myaccount_number>/subscriptions
AArma1/15/2024

Can you call context.waitUntil() multiple times?

After handling a request, I have to save something to KV and make a fetch call to some other service. The order in which they execute does not matter. My code looks like this ```typescript...
EEmo1/15/2024

Workers request lifecycle when using websockets API

Hi! I'm researching how the websockets API works on workers and I was wondering how did it fit on a given workers request lifecycle. Does every message count as one request? how does the app "keep alive" to maintain the connection?
I couldn't find much documentation regarding this, if anyone can help explain or provide more docs 😄...