#Cloudflare deployment help

6 messages · Page 1 of 1 (latest)

plush crescent
#

I incorrectly tried adding like:

  "assets": {
    "binding": "ASSETS",
    "directory": "./dist"
  },

to a wrangler file, but then got the warning [ERROR] Uploading a Pages _worker.js directory as an asset. and the warning This could expose your private server-side code to the public Internet.

zenith osprey
#

Are you trying to deploy to Pages? I have mine set up to integrate with Github directly on push to main, no Wrangler file.

#

You have to give it access to the github repo, then it sets most of the rest up for you

plush crescent
#

I gave it a shot through GitHub, but was getting the error like Missing entry-point to Worker script or to assets directory.

Though I initialized the project with a wrangler file, the deleted it when I was getting errors. Maybe something is out of sync.

#

Here's what my wrangler.json looks like:

{
  "$schema": "node_modules/wrangler/config-schema.json",
  "name": "abc",
  "main": "./dist/_worker.js/index.js",
  "compatibility_date": "2025-04-06",
  "compatibility_flags": ["nodejs_compat"],
  // "site": {
  //   "bucket": "./dist"
  // },
  // "assets": {
  //   "binding": "ASSETS",
  //   "directory": "./dist"
  // },
  // "assets": { "directory": "./public/", "binding": "ASSETS" },
  "observability": {
    "enabled": true
  }

The issue I'm encountering now is that a lot of assets are being built into /dist/_astro, and when I load the page, all of these assets are not found.

plush crescent
#

If I try running without a wrangler file, and deploy straight from the GitHub repo, I get the following output on Cloudflare build:

22:52:42.468      If are uploading a directory of assets, you can either:
22:52:42.468      - Specify the path to the directory of assets via the command line: (ex: `npx wrangler deploy --assets=./dist`)
22:52:42.469      - Or create a "wrangler.jsonc" file containing:
22:52:42.469      
22:52:42.469      
22:52:42.469      {
22:52:42.469        "name": "worker-name",
22:52:42.469        "compatibility_date": "2025-04-06",
22:52:42.469        "assets": {
22:52:42.470          "directory": "./dist"
22:52:42.470        }
22:52:42.470      }