Skip to content

Troubleshooting

SymptomCause and fix
make: golangci-lint: command not foundRebuild the devcontainer, or install golangci-lint v2
File is not properly formatted (gofmt)Run make fmt
noctx complains about httptest.NewRequestUse httptest.NewRequestWithContext(context.Background(), ...)
total coverage ... (min 80%)Add tests for the new code, or see what is uncovered with make cover
Docker build fails at COPY go.sumRun make tidy first
Docker build fails with a Go version errorThe FROM golang: tag in the Dockerfile must be at least the go directive in go.mod
SymptomCause and fix
config: BASE_URL is required and similarA required variable is missing; the message lists all of them
TOKEN_SECRET must be at least 32 bytesUse openssl rand -hex 32
bind: address already in use on 8080Another process, or the make run forward and a Docker container, share port 8080
Subscribers disappear on restartFIRESTORE_PROJECT is unset, so the in-memory store is in use
No email arrives locallySMTP_HOST is unset; the link is in the server log
SymptomCause and fix
CORS error in the consoleSITE_URL does not exactly match the page’s origin (scheme, host, port, no trailing slash)
Preflight failsThe request must be POST with Content-Type: application/json
400 from /v1/subscribeInvalid email, or the list is not in LISTS
Confirmation link goes to /newsletter/invalid/Token expired (24 hours), used after unsubscribing, or TOKEN_SECRET was rotated
Confirmation link 404s on the siteThe result pages are missing from the Astro site
SymptomCause and fix
smtp send: 535 authentication errorWrong app password, or app passwords are disabled for the account
smtp send: 534 or similar2-Step Verification is not enabled
Mail goes to spamCheck SPF, DKIM and DMARC, and that MAIL_FROM is the authenticated mailbox
mail: header injection attemptThe recipient or subject contained a newline
SymptomCause and fix
PERMISSION_DENIED from FirestoreThe service account lacks roles/datastore.user, or the Firestore API or database is not created
Revision fails to startRead the logs (gcloud run services logs read); usually a missing variable or secret access
Permission denied on secretGrant roles/secretmanager.secretAccessor on the specific secret to the runtime service account
Links in emails point to placeholder.invalidDo step 7 of Deployment
Cold start delay on first requestExpected with --min-instances 0; set 1 if it matters (costs money)