Skip to content

🐛 Bug Report: Deployment Fails with "403 Forbidden" Zone Settings Error (Cloudflare) #1166

@rdlogout

Description

@rdlogout

Problem Summary

Deployment to production fails when Alchemy attempts to fetch Cloudflare zone settings, resulting in a 403 Forbidden error during the route creation process.

ERROR Scope failed [app-name]/production/[app-name]-backend/api.[domain].com/*
Error: Failed to fetch zone settings: 403 Forbidden
at getZoneSettings (/path/to/alchemy/src/cloudflare/zone.ts:514:11)
at getZoneByDomain (/path/to/alchemy/src/cloudflare/zone.ts:592:20)
at inferZoneIdFromPattern (/path/to/alchemy/src/cloudflare/route.ts:467:12)

Environment

  • Alchemy Version : v0.75.1
  • Node.js Version : v24.7.0
  • Stage : production
  • Command : alchemy deploy --env-file .env --adopt --stage production

Configuration

The deployment configuration includes:

  • Worker with custom routes pattern: api.[domain].com/*
  • Smart placement mode enabled
  • Adoption mode enabled ( adopt: true )
  • Custom domain configuration

Expected Behavior

Deployment should complete successfully with proper zone settings access and route creation.

Cloudflare Profile Configuration

Profile: default

  • cloudflare: [redacted]@gmail.com's Account
  • Method: oauth
  • Scopes: account:read, user:read, workers:write, workers_kv:write,
    workers_routes:write, workers_scripts:write, workers_tail:read,
    d1:write, pages:write, zone:read, ssl_certs:write, ai:write,
    queues:write, pipelines:write, secrets_store:write, containers:write,
    cloudchamber:write, access:write, cfone:read, cfone:write,
    dns_records:edit, dns_records:read, dns_settings:read, lb:edit,
    lb:read, offline_access

alchemy.run.ts file worker defination

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions