stibbs
CDCloudflare Developers
•Created by stibbs on 5/10/2024 in #workers-help
How to rapidly validate if a JS package will work on Workers runtime?
Like the old 'Works on Workers' catalogue which disappeared. Node.js / javascript / typescript packages.
I know this page exists: https://developers.cloudflare.com/workers/runtime-apis/nodejs/ but without a deep dive into other packages you cannot identify whether a package will 'just work'. As an example of two popular packages,
stripe
works but @sendgrid/mail
doesn't
Is it a matter of trial and error? Or Google [package] cloudflare workers
each time and hope someone has written a blog post? That will become exhausting quickly.
Or assume nothing works and default to building from scratch (or more likely, electing to run my FaaS elsewhere.. 😢 )
This sounded really whingy and I don't intend it to be. I really love the product, it is just not the easiest to use right now!5 replies
CDCloudflare Developers
•Created by stibbs on 5/6/2024 in #pages-help
Are environment variables available at build or only runtime?
My SvelteKit builds fail when I use
import { SECRET } from '$env/static/private'
or the public equivalent ($env/static/public
) with an error such as:
However accessing environment variables via import { env } from '$env/dynamic/private';
works.
Is it correct to assume environment variables created on Cloudflare Pages are only available at runtime?52 replies
CDCloudflare Developers
•Created by stibbs on 5/2/2024 in #pages-help
Is it possible to make the build system ignore asdf .tool-versions?
Is it possible to make the build system ignore
.tool-versions
?
There are prior threads on here + on community.cloudflare.com (e.g., https://community.cloudflare.com/t/how-to-disable-automatic-installs-of-tool-versions-and-package-json/570450)
I've set the NODE_VERSION = 22.0.0
environment variable in the build settings.
Failed build log:
1 replies
CDCloudflare Developers
•Created by stibbs on 5/1/2024 in #pages-help
How do I work with local D1 in a SvelteKit project?
I've created a new SvelteKit project and can successfully interact with hosted D1 after following the guide https://developers.cloudflare.com/d1/examples/d1-and-sveltekit/. Using
pnpm dev
to launch the SvelteKit local dev environment as standard works for the hosted D1.
However I would like to develop locally also. The guide advises to pass --d1 BINDING_NAME=DATABASE_ID
to wrangler dev (e.g., npx wrangler dev --d1 DB=example-uuid-here
) but this results in ✘ [ERROR] Unknown argument: d1
(which aligns with wrangler's docs https://developers.cloudflare.com/workers/wrangler/commands/#dev, no d1 option exists)
I have the following config:
If I run npx wrangler dev
I receive: ✘ [ERROR] Missing entry-point: The entry-point should be specified via the command line (e.g.
wrangler dev path/to/script) or the
main config field.
8 replies