Skip to content

HAMUR_W2078: A server.cdnPurge token is a literal string

A server.cdnPurge token is a literal string. Warning HAMUR_W2078 belongs to hamur, server (2001 – 2999).

Message

text
HAMUR_W2078 server.cdnPurge.<host>.token is a literal string, which the build writes into the server output; use env("NAME") to read it at server start

Cause

server.cdnPurge.<host>.token is a literal string in the config, which the build writes into the server output.

Fix

Declare the variable in app/env.ts and write env("NAME"), so the token is read at server start.

ts
import { defineConfig, env } from "hamur"

export default defineConfig({
  framework: "react",
  preset: "vercel",
  server: { cdnPurge: { vercel: { projectId: "prj_example", token: env("VERCEL_PURGE_TOKEN") } } },
})