voltron
voltron
CDCloudflare Developers
Created by voltron on 3/4/2025 in #pages-help
how to use build-time secrets with Astro
hey folks I'm building an Astro site that relies on a build-time secret, assuming for prerendering but it's really only needed for runtime. I've defined this var in my env schema, but I'm encountering a build error with this var defined in my settings
17:59:51.389 01:59:51 [ERROR] [vite] x Build failed in 10ms
17:59:51.594 [EnvInvalidVariables] [astro-env-plugin] The following environment variables defined in `env.schema` are invalid:
17:59:51.595
17:59:51.595 - SPOTIFY_REFRESH_TOKEN is missing
17:59:51.595
17:59:51.595 Error reference:
17:59:51.596 https://docs.astro.build/en/reference/errors/env-invalid-variables/
17:59:51.389 01:59:51 [ERROR] [vite] x Build failed in 10ms
17:59:51.594 [EnvInvalidVariables] [astro-env-plugin] The following environment variables defined in `env.schema` are invalid:
17:59:51.595
17:59:51.595 - SPOTIFY_REFRESH_TOKEN is missing
17:59:51.595
17:59:51.595 Error reference:
17:59:51.596 https://docs.astro.build/en/reference/errors/env-invalid-variables/
I've got this defined in my astro config
export default defineConfig({
adapter: cloudflare(),
output: "server",
site: "https://josef.dev",
env: {
schema: {
SPOTIFY_CLIENT_ID: envField.string({
access: "secret",
context: "server",
optional: true,
}),
SPOTIFY_CLIENT_SECRET: envField.string({
access: "secret",
context: "server",
optional: true,
}),
SPOTIFY_REFRESH_TOKEN: envField.string({
access: "secret",
context: "server",
}),
},
validateSecrets: true,
},
export default defineConfig({
adapter: cloudflare(),
output: "server",
site: "https://josef.dev",
env: {
schema: {
SPOTIFY_CLIENT_ID: envField.string({
access: "secret",
context: "server",
optional: true,
}),
SPOTIFY_CLIENT_SECRET: envField.string({
access: "secret",
context: "server",
optional: true,
}),
SPOTIFY_REFRESH_TOKEN: envField.string({
access: "secret",
context: "server",
}),
},
validateSecrets: true,
},
3 replies
CDCloudflare Developers
Created by voltron on 1/27/2024 in #pages-help
astro site with kv binding deploys but doesn't work
Hey folks 👋 I've got a working astro site with no special setup or the cloudflare integration, and I'm on to my second but this one has a KV binding that I'm attempting to access on the homepage. Things deploy fine/no build errors, but the site throws a 500 and I'm not sure where to find the logs
// astro.config.mjs
import { defineConfig } from "astro/config"
import svelte from "@astrojs/svelte"
import tailwind from "@astrojs/tailwind"
import cloudflare from "@astrojs/cloudflare"

// https://astro.build/config
export default defineConfig({
integrations: [svelte(), tailwind()],
output: "server",
adapter: cloudflare({
runtime: {
mode: "local",
type: "pages",
bindings: {
A_LINKS_KV: {
type: "kv",
},
},
},
}),
})
// astro.config.mjs
import { defineConfig } from "astro/config"
import svelte from "@astrojs/svelte"
import tailwind from "@astrojs/tailwind"
import cloudflare from "@astrojs/cloudflare"

// https://astro.build/config
export default defineConfig({
integrations: [svelte(), tailwind()],
output: "server",
adapter: cloudflare({
runtime: {
mode: "local",
type: "pages",
bindings: {
A_LINKS_KV: {
type: "kv",
},
},
},
}),
})
6 replies
CDCloudflare Developers
Created by voltron on 8/18/2023 in #general-help
Transferring a .dev domain
Hey folks I was looking to transfer all of my domains out of Google and to Cloudflare, but I have an issue with the .dev "premium domain". It shows the domain as "available" and (sometimes) validates my transfer auth code, but I get a generic failure when attempting to submit the transfer. Are .dev domains not yet available on Cloudflare? I vaguely remember seeing a popup somewhere in the console about this but I haven't seen it since
5 replies