richburdon
richburdon
Explore posts from servers
CDCloudflare Developers
Created by richburdon on 10/23/2024 in #workers-help
API and limits for email routing?
Is there an API to create email routes for workers? If so are there limits to how many routes can be created (e.g., is it appropriate to create a route for each user of a particular application services? i.e., many thousands?) If not, is there another way to achieve this with the CF platform? Thanks.
2 replies
CDCloudflare Developers
Created by richburdon on 7/27/2024 in #workers-help
prisma migrations fail if there are multiple databases
running migrations throws an error if there are multiple databases.
❯ npx prisma migrate diff --from-local-d1 --to-schema-datamodel ./prisma/schema.prisma --script --output migrations/0002_rename_referrer.sql

Error: Multiple Cloudflare D1 databases found in .wrangler/state/v3/d1/miniflare-D1DatabaseObject. Please manually specify the local D1 database with `--from-url file:`, without using the `--from-local-d1` flag.
❯ npx prisma migrate diff --from-local-d1 --to-schema-datamodel ./prisma/schema.prisma --script --output migrations/0002_rename_referrer.sql

Error: Multiple Cloudflare D1 databases found in .wrangler/state/v3/d1/miniflare-D1DatabaseObject. Please manually specify the local D1 database with `--from-url file:`, without using the `--from-local-d1` flag.
i figured out by trial and error that useing --from-url and guessing one of the sql files in .wrangler/state/d1 works, but is there a better way to determine which file to use?
1 replies
CDCloudflare Developers
Created by richburdon on 7/26/2024 in #workers-help
migration
My staging and production environments got out of sync and so the [[migrations]] (various new_classes and renamed_classes) don't match. is there a way to just "start again" with respect to declaring DOs? i.e., start all environments back to v1 (or any tag really).
3 replies
CDCloudflare Developers
Created by richburdon on 7/14/2024 in #workers-help
Workers timing out
Deploy timing out. Also reporting issue timinig. out. Does CF have a status page for all devlopment services?
✘ [ERROR] fetch failed


If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
✔ Would you like to report this error to Cloudflare? … yes
TypeError: fetch failed
at fetch (/Users/burdon/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:17227:19)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at runNextTicks (node:internal/process/task_queues:64:3)
at process.processImmediate (node:internal/timers:447:9)
at async transportSentry10 (/Users/burdon/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:198186:26) {
cause: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (/Users/burdon/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:6049:29)
at /Users/burdon/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:6005:51
at Immediate._onImmediate (/Users/burdon/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:6037:13)
at process.processImmediate (node:internal/timers:476:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
✘ [ERROR] fetch failed


If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
✔ Would you like to report this error to Cloudflare? … yes
TypeError: fetch failed
at fetch (/Users/burdon/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:17227:19)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at runNextTicks (node:internal/process/task_queues:64:3)
at process.processImmediate (node:internal/timers:447:9)
at async transportSentry10 (/Users/burdon/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:198186:26) {
cause: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (/Users/burdon/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:6049:29)
at /Users/burdon/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:6005:51
at Immediate._onImmediate (/Users/burdon/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:6037:13)
at process.processImmediate (node:internal/timers:476:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
3 replies
CDCloudflare Developers
Created by richburdon on 7/14/2024 in #workers-help
Configuring cors during development
In development I'm serving a JS app from a pages project and a local dev worker. since these are on different ports there's a XSS issue. I've configured CORS and can make the appropriate requests, but I can't access cookies returned from the worker in the JS frontend. I'm trying to establish a session cookie that is passed between subsequent POST requests from the frontend.
1 replies
CDCloudflare Developers
Created by richburdon on 7/13/2024 in #workers-help
Remove/ignore lib.dom.d.ts
I've included the CF type definitions and have NOT explicitely included the DOM lib, but some other lib must be including it and subsequently the DOM types overrides (like Response.webSocket) are hidden and these references are showing up as errors.
src/email/mailbox-api.ts:33:25 - error TS2339: Property 'webSocket' does not exist on type 'Response'.

33 webSocket: response.webSocket,
~~~~~~~~~
src/email/mailbox-api.ts:33:25 - error TS2339: Property 'webSocket' does not exist on type 'Response'.

33 webSocket: response.webSocket,
~~~~~~~~~
My tsconfig looks like this:
"compilerOptions": {
"noEmit": true,
"outDir": "./dist",
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx",
"lib": [
"ESNext",
],
"types": [
// NOTE: Must not add "DOM" to lib property.
"@cloudflare/workers-types/2023-07-01",
"@cloudflare/vitest-pool-workers",
"hono",
],

// TODO(burdon): Standardize with dxos/edge.
"module": "ESNext",
"moduleResolution": "Bundler",
"target": "ESNext"
},
"compilerOptions": {
"noEmit": true,
"outDir": "./dist",
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx",
"lib": [
"ESNext",
],
"types": [
// NOTE: Must not add "DOM" to lib property.
"@cloudflare/workers-types/2023-07-01",
"@cloudflare/vitest-pool-workers",
"hono",
],

// TODO(burdon): Standardize with dxos/edge.
"module": "ESNext",
"moduleResolution": "Bundler",
"target": "ESNext"
},
1 replies
CDCloudflare Developers
Created by richburdon on 6/19/2024 in #workers-help
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
✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
Uncaught Error: EvalError: Code generation from strings disallowed for this context
✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
2 replies
CDCloudflare Developers
Created by richburdon on 6/2/2024 in #pages-help
wrangler pages deployment tail error
✘ [ERROR] No deployments for environment: production the following command fails wrangler pages deployment tail --project-name=composer --environment=production unless i specifcially give the --deployment
10 replies
CDCloudflare Developers
Created by richburdon on 5/15/2024 in #workers-help
Parsing email
I've tried to use a couple of popular email parsing libraries (textract, mailparser) to parse the raw text received by an email worker, but so far I haven't found anything compatible with the CF runtime environment. For example, I get errors like below during deploy. Missing pacakges incude node:buffer, node:stream, crypto, path, etc.
▲ [WARNING] The package "node:buffer" wasn't found on the file system but is built into node.
▲ [WARNING] The package "node:buffer" wasn't found on the file system but is built into node.
3 replies
CDCloudflare Developers
Created by richburdon on 5/14/2024 in #pages-help
How to change and manage subdomains?
I have a Pages "app/project" with custom domains. I can't see how to change the assigned subdomain associated with the Page (e.g., foo.pages.dev).
17 replies
CDCloudflare Developers
Created by richburdon on 5/4/2024 in #workers-help
How to get the name of a durable object
I'm creating durable objects via this.env.SWARM.get(this.env.SWARM.idFromName(HEX_STRING)) But when i call this.ctx.id.name inside the object it is undefined. Is there a way to get name -- or associate other state with the object during its construction/instantiation?
8 replies
CDCloudflare Developers
Created by richburdon on 5/3/2024 in #pages-help
env.ASSETS.fetch doesn't return additional headers
I have a Pages project with a worker (advanced config) that attempts to add a cookie via adding headers to the env.ASSETS.fetch call
return await env.ASSETS.fetch(request, {
headers: {
'Set-Cookie': `${cookie}=${jwt}; Secure`
}
});
return await env.ASSETS.fetch(request, {
headers: {
'Set-Cookie': `${cookie}=${jwt}; Secure`
}
});
the headers are not returned. to sanity check if i return the following ther are:
return new Response(null, {
headers: {
'Set-Cookie': `${cookie}=${jwt}; Secure`
}
});
return new Response(null, {
headers: {
'Set-Cookie': `${cookie}=${jwt}; Secure`
}
});
to workaround i could either redirect (with the cookies), but what i'm attempting above seems reasonable so i wonder if there's an API bug?
34 replies
CDCloudflare Developers
Created by richburdon on 4/29/2024 in #general-help
I don't see how to initiate a domain transfer into CF
I have an auth code from the current registrar -- what do i do with that?
25 replies
CDCloudflare Developers
Created by richburdon on 4/27/2024 in #pages-help
Error while building Pages Functions from monorepo (nx): Could not resolve
I have a monorepo that contains a Pages project and a library that the Pages _worker.js function depends on. During the CF build I get the following error (which works fine locally).
22:20:45.746 > build:functions
22:20:45.746 > esbuild ./src/functions/_worker.ts --bundle --format=cjs --outfile=./dist/_worker.js
22:20:45.778 [ERROR] Could not resolve "@dxos/web-auth"
22:20:45.746 > build:functions
22:20:45.746 > esbuild ./src/functions/_worker.ts --bundle --format=cjs --outfile=./dist/_worker.js
22:20:45.778 [ERROR] Could not resolve "@dxos/web-auth"
I suspect this might be related to the module being part of a monorepo?
9 replies
CDCloudflare Developers
Created by richburdon on 4/24/2024 in #general-help
I upgraded to business but I still am not able to access support.
My workers started failing; I upgraded to business but I still am not able to access support.
35 replies