Questions tagged [cloudflare-workers]

146 questions
13
votes
2 answers

Cloudflare Workers - SPA with Vuejs

Hello I have deployed my Vue.js app to Cloudflare workers using the following commands: wrangler generate --site wrangler publish --env dev This is my wrangler.toml: account_id = "xxx" name = "name" type = "webpack" workers_dev =…
Marcos Aguayo
  • 5,393
  • 7
  • 25
  • 56
7
votes
2 answers

CloudFlare Workers - Check for Cookie, Add Headers, Set Cookie

I want to dynamically add http-headers via CloudFlare workers ONLY for the first time visitors. For example these headers: Link: ; rel=preload; as=style; nopush Link: ; rel=preload; as=script; nopush So, what…
6
votes
2 answers

Next.js - Serverless rendering with Clouflare Workers?

I'm using Next.js v9 and would like to take advantage of Next's serverless deployment option by using my application with Cloudflare Workers. From the Next.js docs, I know that every serverless function created by Next has the following…
mrstack999
  • 177
  • 1
  • 11
5
votes
1 answer

How to get the current date in a Cloudflare's worker

The usual Date object on Cloudflare's workers, all return 1 jan,1970... What is the proper way to get the current datetime in a workers' code? Thanks, G
wanted
  • 309
  • 2
  • 11
5
votes
1 answer

How can I make an asynchronous request (non-blocking) using a Cloudflare Worker

I'm writing a Cloudflare Worker that needs to ping an analytics service after my original request has completed. I don't want it to block the original request, as I don't want latency or a failure of the analytics system to slow down or break…
Zack Bloom
  • 8,059
  • 2
  • 17
  • 26
4
votes
0 answers

How to fix authentication error code 10000 in cloudflare

There is problem, i keep encountering in cloudflare. It says - authentication error (code 10000) while logging to my cloudflare dashbord. don't know why that's happen,but i searched for that problem on google,ask cloudflare help center, but did't…
4
votes
1 answer

Accessing Compressed Data for Cloudflare Workers Sites

My cloudflare workers site houses binary data that a react app fetches. This binary data is stored as gzip compressed as it compresses extremely well (we're talking about a 20-25x reduction and uncompressed it is too large to fit in the 10MB KV…
Nick Babcock
  • 5,842
  • 3
  • 24
  • 39
4
votes
2 answers

What are cloudflare KV preview_ids and how to get one?

I have a following wrangler.toml. When I would like to use dev or preview (e.g. npx wrangler dev or npx wrangler preview) wrangler asks to add a preview_id to the KV namespaces. Is this an identifier to an existing KV namespace? I see there is a…
Veksi
  • 2,868
  • 1
  • 20
  • 52
3
votes
1 answer

run vue3 ssr on cloudflare workers

I'm trying to run a vue ssr app on cloudflare workers. I generated a new project using wrangler generate test I installed vue using npm install vue@next and npm install @vue/server-renderer I edited the index.js file like this: const { createSSRApp…
user1885099
  • 54
  • 2
  • 5
  • 26
3
votes
1 answer

Send an image to Telegram with Cloudflare Workers

I trying to send an image to Telegram with Cloudflare Workers, but I don’t receive the image in my Telegram account. Also my code correctly work in Chrome developer console, so a problem is in Cloudflare Workers. Could you help me? function…
Max
  • 31
  • 2
3
votes
3 answers

How to locally run my cloudflare worker serverless function, during development?

I managed to deploy my first cloudflare worker using serverless framework according to https://serverless.com/framework/docs/providers/cloudflare/guide/ and it is working when I hit the cloud. During development, would like to be able to test on…
3
votes
1 answer

How can I make a Cloudflare worker which overwrites a response status code but preserves the rest of the response?

Specifically I am interested in changing all responses with code 403 to code 404, and changing all responses with code 301 to 302. I do not want any other part of the response to change, except the status text (which I want to be empty). Below is my…
2
votes
0 answers

Webpack targeting webworker won't import browser version of a dependency

I'm writing a CloudFlare worker and I have the following webpack.config.js: 'use strict'; module.exports = { devtool: 'source-map', entry: './src/main.ts', module: { rules: [ { test: /\.html$/, loader:…
btmorex
  • 356
  • 3
  • 13
2
votes
2 answers

How can I modify the Response (substituting strings) using Javascript?

The following Javscript (running in Cloudflare Workers) does two things: It allows me to substitute my domain satchel.id for domain.com (this works) I added code to substitute 'satchel.id' for 'domain.com' -- this doesn't work /** * An…
Satchel
  • 15,436
  • 22
  • 100
  • 180
2
votes
1 answer

Viewing Error Logs for Cloudflare Workers (Error 1101)

I'm developing a script to run on Cloudflare Workers and it's throwing an error: If you are the owner of this website: you should login to Cloudflare and check the error logs for app.something.workers.dev. I can't however figure out where to find…
1
2 3
9 10