MBrimmer
MBrimmer
Explore posts from servers
CDCloudflare Developers
Created by s9tpepper on 5/16/2024 in #workers-help
Cannot file module '@cloudflare:workers'
I think I solved it by upgrading "@Cloudflare/workers-types" to the latest version.
26 replies
CDCloudflare Developers
Created by s9tpepper on 5/16/2024 in #workers-help
Cannot file module '@cloudflare:workers'
yarn add cloudflare:workers
➤ YN0027: cloudflare:workers@unknown can't be resolved to a satisfying range
➤ YN0035: Package not found
➤ YN0035: Response Code: 404 (Not Found)
➤ YN0035: Request Method: GET
➤ YN0035: Request URL: https://registry.yarnpkg.com/cloudflare:workers

➤ Errors happened when preparing the environment required to run this command.
yarn add cloudflare:workers
➤ YN0027: cloudflare:workers@unknown can't be resolved to a satisfying range
➤ YN0035: Package not found
➤ YN0035: Response Code: 404 (Not Found)
➤ YN0035: Request Method: GET
➤ YN0035: Request URL: https://registry.yarnpkg.com/cloudflare:workers

➤ Errors happened when preparing the environment required to run this command.
26 replies
CDCloudflare Developers
Created by s9tpepper on 5/16/2024 in #workers-help
Cannot file module '@cloudflare:workers'
@s9tpepper Were you able to resolve "The error about being unable to resolve cloudflare:workers is still there though - not sure why"? If so how?
26 replies
CDCloudflare Developers
Created by MBrimmer on 1/24/2024 in #pages-help
Pages custom domain with workers using custom subdomain.
Thank you
11 replies
CDCloudflare Developers
Created by MBrimmer on 1/24/2024 in #pages-help
Pages custom domain with workers using custom subdomain.
and once I deploy to production instead of preview, it'll start working?
11 replies
CDCloudflare Developers
Created by MBrimmer on 1/24/2024 in #pages-help
Pages custom domain with workers using custom subdomain.
Those ip's are vercel and I'm moving everything to cloudflare now
11 replies
CDCloudflare Developers
Created by MBrimmer on 1/24/2024 in #pages-help
Pages custom domain with workers using custom subdomain.
But I should delete those A records, right?
11 replies
CDCloudflare Developers
Created by MBrimmer on 1/24/2024 in #pages-help
Pages custom domain with workers using custom subdomain.
Oh they are all preview
11 replies
CDCloudflare Developers
Created by MBrimmer on 1/24/2024 in #pages-help
Pages custom domain with workers using custom subdomain.
All four "A" records ip addresses point to vercel which is where I moved from. I'm guessing I need to delete those records but I don't know what there replacement should be
11 replies
CDCloudflare Developers
Created by MBrimmer on 10/5/2023 in #kv
I m having a problem with my KV Cache I
Hey @MattD | WorkersKV Sorry, not sure how I missed your response. The issue is CLOUDFLARE_KV_NAMESPACE is a string that tells my application which namespace e.g. development-namespace or production-namespace and is defined at runtime not compile time. Cloudflare provides my namespace as defined by my wrangler config. So this is only a typescript issue now and I solved it like this.
namespace: env[
env.CLOUDFLARE_KV_NAMESPACE as keyof typeof env
] as unknown as KVNamespace
namespace: env[
env.CLOUDFLARE_KV_NAMESPACE as keyof typeof env
] as unknown as KVNamespace
Not sure if this is how other people are doing it, but it working for me right now. Thanks for getting back with me!
8 replies
CDCloudflare Developers
Created by MBrimmer on 10/5/2023 in #kv
I m having a problem with my KV Cache I
I figured this out but my Typescript is still wrong I now access my Namespace from the env with the name passed as an environment variable like this
// @ts-ignore
const cache = new KVCache<GooglePublicKeys>(env[env.CLOUDFLARE_KV_NAMESPACE] as KVNamespace)
// @ts-ignore
const cache = new KVCache<GooglePublicKeys>(env[env.CLOUDFLARE_KV_NAMESPACE] as KVNamespace)
I have the env typed with an interface and the Namespace doesn't play well with that approach.
8 replies
CDCloudflare Developers
Created by MBrimmer on 9/12/2023 in #workers-discussions
Eliminating cold starts with Cloudflare ...
A little more context. Im testing via a health check endpoint inside my function. My function contains TRPC for routing and the Prisma edge client connected to data-proxy, i'm not hitting routes that go to the database or make external requests. Certainly appears that i'm doing something wrong to get 2.5 second starts on a small simple function(small router).
6 replies
CDCloudflare Developers
Created by MBrimmer on 9/12/2023 in #workers-discussions
Eliminating cold starts with Cloudflare ...
@kian Any ideas that I might try? I'm still using a path, but have no routes set. All requests to the subdomain should go to this worker.
6 replies
CDCloudflare Developers
Created by MBrimmer on 9/12/2023 in #workers-discussions
Eliminating cold starts with Cloudflare ...
My bundle size Total Upload: 3870.40 KiB / gzip: 561.21 KiB
6 replies
CDCloudflare Developers
Created by MBrimmer on 9/12/2023 in #workers-discussions
Eliminating cold starts with Cloudflare ...
Switching to paid plan doesn't seem to help at all
6 replies
CDCloudflare Developers
Created by MBrimmer on 9/12/2023 in #workers-discussions
Eliminating cold starts with Cloudflare ...
Hmm, maybe not. After 30 minutes, it's back at 2 seconds.
6 replies
CDCloudflare Developers
Created by MBrimmer on 9/12/2023 in #workers-discussions
Eliminating cold starts with Cloudflare ...
Initial testing seems to indicate my assumption is correct. Initially my cold start was around 2 second and appears to have gone down to around 300 ms when I eliminate the route. In both cases when the worker is warm, the requests are around 60 ms.
6 replies
CDCloudflare Developers
Created by MBrimmer on 9/12/2023 in #workers-help
Worker custom domain routes
This appears to work, maybe.
[env.development]
routes = [
{ pattern = "development-api.example.com", custom_domain = true },
{ pattern = "https://development-api.example.com/trpc/auth*", zone_name = "example.com" }
]
[env.development]
routes = [
{ pattern = "development-api.example.com", custom_domain = true },
{ pattern = "https://development-api.example.com/trpc/auth*", zone_name = "example.com" }
]
I'd love some clarification, explanation, or further guidance on this. I don't think I fully understand why routes and custom_domains are separate.
3 replies