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

CPU exceeded error

Hi team, I'm trying to create a PDF file that has 20-30 pages, and the cpu time exceeds the limitation. What is the best option to solve this issue? Should I upgrade to Unbound model ...

Excluding Tests

Hi All. I am building a service with Workers and I have my tests in a subfolder of each controller "{controller_name}/specs". I am concerned about them bloating the package when I deploy to production. Does anyone know the correct and preferred way to exclude them from the production build?

analytics engine timestamp

I have a iot device that is capturing data points and sending them to a worker that stores them in workers analytics engine. I want to have my device buffer data in the event of WiFi errors and send when reconnected to the network. Is there a way to provide a timestamp to the data point instead of relying on the auto generated one?

Can I write a data URI to an R2 bucket?

Is it possible to write to an R2 bucket with a base64 data URI i.e.
await env.r2_pub.put('some/file', 'data:image/png;base64,i5Gkw...');
await env.r2_pub.put('some/file', 'data:image/png;base64,i5Gkw...');
? That fails (it creates a text file with literally that content), but perhaps there's a way to encode the file contents first such that R2 accepts it?...

How to validate a file upload in Workers before saving it to R2?

I've spent ages trying to resolve this. I know how to upload a file and save it to R2. What I can't figure out is best practice to validate the file first. Lots of resources out there say use something like Formiddable, but I can't believe I need a third-party library just to enforce things like "must be a PDF" or "must be under 100kb". I know the Workers R2 API allows the stipulation of conditions on PUT operations, but these conditions don't seem to relate to the sort of conditions I mention above....

extensive API on cloudflare Workers

Hi, I'm starting a new project, while I've been working with cloudflare for only a short time, and I'm wondering whether it makes sense to create a backend based on Workers (using hono.dev), which is quite extensive (logging in, registration, user/project management, etc.) or better to choose classic Express.JS. But with the use of Express.JS I would still depend on using cloudflare to host the API, and I am also wondering how best to do it

content security policy changes with workers

I could not make changes to our current worker codes, from UI. Do you know about the problem?

cloudflare worker network support

I need to create cloudflare workers like worker1 has only IPv6 network enabled and worker2 has only Ipv4 network enabled.

Deployment suggestion

Due to certain reasons, I am unable to deploy the worker on Cloudflare. Therefore, I have to deploy it on my own server. Currently, I am using wrangler dev for deployment, but it reloads the code and supports only single-threaded execution. To better deploy on my own server, I need a more optimized solution. Could you please provide some suggestions? Thank you!...

K6 load testing and 429s

Hey team Currently been working on load testing a simple worker (just a JS 10 liner kind of deal) we have (non-free/ent tier) and have found that when trying to perform load testing using K6 we begin to see a flood of 429's I did find this post: https://community.cloudflare.com/t/can-requests-to-workers-get-rate-limited/435598/2...

Switch cases with only one Cron Job?

```javascript async scheduled(event: ScheduledEvent, env: Env, ctx: ExecutionContext): Promise<void> { /* */...

Failed to publish your Function

Hello ! For some reasons I have some troubles publishing this branch to CF Worker but I have no clue why. Logs end up with that: 10:44:03.483 ✨ Success! Uploaded 5 files (1789 already uploaded) (3.61 sec) 10:44:03.483
10:44:04.036 ✨ Upload complete! 10:44:05.528 Skipping build output cache as it's not supported for your project...

Dashboard can't count Chinese characters correctly

I was creating a new deployment and adding a comment to it, the dashboard said I can add 25 more characters to the comment, but it showed an error that said the comment exceeds maximum length 50.
No description

Uncaught Error: EvalError: Code generation from strings disallowed for this context

Out of the blue I started getting this error in miniflare (local dev). None of my code is calling eval and so far I can't find anything in my deps. In general can anyone suggest how to debug workers that fail to startup. ``` Uncaught Error: EvalError: Code generation from strings disallowed for this context...

D1 Best Practices dev/prod modes and --local and --remote flags

Hi! What are best practices around databases with D1 for building web apps that have dev and prod modes? I tried creating a wrangler.toml like this:...

针对反代理Github一事的回复

Cloudflare团队,您好 最近我收到了有关报告URL:https://git.ikunweb.eu.org/ 疑似网络钓鱼的问题的邮件。我承认,这在很大程度上侵犯了用户的隐私,我现已将其所属的Cloudflare Worker完全删除。 这个举动不是有意而为的,此网站主要是针对无法访问Github网站的国家和地区(如中国大陆)准备的,因为在那些国家和地区,用户无法正常的访问Github网站,无法体验到开源与自由的软件生态,于是便有了这个项目,利用Cloudflare的全球CDN加速,让那些无法访问Github网站的国家和地区也可以正常的体验到开源与自由的软件生态,但这在那些可以正常访问Github网站的国家却变成了网络钓鱼。这是我的疏忽和大意,我承认,这在很大程度上侵犯了用户的隐私,我现已将其所属资源完全删除。 能否向举报者转达此消息?致谢!...

"SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON" on authorization

When I tried to do "wrangler deploy" for a new project and authorizing my Cloudflare account to it, I got this error. I've never had this issue until today. Any ideas on how to fix this issue?
No description

Could not resolve "fs", "http", "https", "url", ....

Hey, I'm using Hono in the backend, from where I'm uploading an image to Cloudinary. As I installed the Cloudinary package, it has some dependencies of its own, such as 'fs', 'https', 'http', 'url', etc. Unfortunately, Cloudflare Workers do not support these Node.js packages. I tried adding node_compat in my wrangler.toml file, but it didn't fix anything. I can't add "node:" to each of those packages, as they are all Cloudinary dependencies. The same is the case with the 'bcrypt' package. I've certainly lost 20% of my brain cells working on it. Any help is appreciated!...
No description

Error in the Create Cloudflare CLI setup wizard

Currently going through the Setup wizard for create-cloudflare using bunx [Command: bunx create-cloudflare@latest] I have tried to use npm and bun both, but at the second step it seems to give this error: TypeError: n2.node.body.findLastIndex is not a function. Have also attached a screenshot of the terminal. Any help would be greatly appreciated!...
No description

API not accessible from android device using workers

We are currently using Workers to deploy our API. However, when attempting to access the API endpoint http://127.0.0.1:8787/ from an Android device, we encounter a "Network request failed" error. Notably, this endpoint functions correctly when accessed via Postman or a web browser, and there are no firewall issues affecting the connection. Also we are able to access the deployed url but not the local url . Could you please assist us in resolving this issue?...