Everything in wrangler.toml is safe to share, account id/db id/etc are all ok to be public
Everything in wrangler.toml is safe to share, account id/db id/etc are all ok to be public
—from-dash option in wrangler init: https://developers.cloudflare.com/workers/wrangler/commands/#init
Assets Uploaded tab show on the deployment logs in Cloudflare?@cloudflare/next-on-pages@1 package. This requires me to add a wrangler.toml file to my project root as it complained about a missing nodejs_compat flag I needed to set, which I have done in the wrangler config. 1a9dcf7c to a commit in my repo? Is there a standard way to do so?getPlatformProxy and miniflare/workerd ?getPlatformProxy:drizzle(db) and waiting for ~1sec):wrangler dev on a worker and I can't access the bindings made from anotehr worker—from-dashwrangler initAssets Uploaded@cloudflare/next-on-pages@1env
NODE_VERSION 20.11.1
import {
defineWorkersConfig,
readD1Migrations
} from '@cloudflare/vitest-pool-workers/config'
export default defineWorkersConfig(async () => {
const migrations = await readD1Migrations('./src/migrations')
return {
test: {
globals: true,
poolOptions: {
workers: {
isolatedStorage: true,
miniflare: {
d1Databases: {
DB: 'db-tests'
},
bindings: {
TEST_MIGRATIONS: migrations
},
compatibilityDate: '2024-11-20',
compatibilityFlags: ['nodejs_compat']
}
}
}
}
}
})name: Deploy Cloudflare Workers
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy to Cloudflare Workers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Create wrangler.toml dynamically
run: |
cat <<EOF > wrangler.toml
name = "${{ secrets.PROJECT_NAME }}"
main = "src/index.ts"
compatibility_date = "2024-11-20"
compatibility_flags = ["nodejs_compat"]
[[d1_databases]]
binding = "DB"
database_name = "${{ secrets.D1_DATABASE_NAME }}"
database_id = "${{ secrets.D1_DATABASE_ID }}"
migrations_dir = "./src/migrations"
EOF
- name: Run Tests, Migrations and Deploy using Cloudflare CLI environment
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
preCommands: |
pnpm test
pnpm migration:prod
1a9dcf7cgetPlatformProxygetPlatformProxy/home/naourass/web_exp/phoenix-astro-next/node_modules/undici/index.js:112
Error.captureStackTrace(err, this)
^
TypeError: fetch failed
at Object.fetch (/home/naourass/web_exp/phoenix-astro-next/node_modules/undici/index.js:112:15)
at fetch3 (/home/naourass/web_exp/phoenix-astro-next/node_modules/miniflare/src/http/fetch.ts:90:19)
at ProxyClientBridge.dispatchFetch (/home/naourass/web_exp/phoenix-astro-next/node_modules/miniflare/src/index.ts:1647:20)
at ProxyStubHandler.#parseAsyncResponse (/home/naourass/web_exp/phoenix-astro-next/node_modules/miniflare/src/plugins/core/proxy/client.ts:339:15)
at D1PreparedQuery.get (/home/naourass/web_exp/phoenix-astro-next/node_modules/src/d1/session.ts:223:16) {
cause: SocketError: other side closed
at Socket.onSocketEnd (/home/naourass/web_exp/phoenix-astro-next/node_modules/undici/lib/client.js:1118:22)
at Socket.emit (node:events:529:35)
at Socket.emit (node:domain:489:12)
at endReadableNT (node:internal/streams/readable:1400:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'UND_ERR_SOCKET',
socket: {
localAddress: '127.0.0.1',
localPort: 57506,
remoteAddress: undefined,
remotePort: undefined,
remoteFamily: undefined,
timeout: undefined,
bytesWritten: 1091,
bytesRead: 1783105
}
}
}drizzle(db)npx wrangler dev
✘ [ERROR] service core:user:hello-world: Uncaught LinkError: WebAssembly.Instance(): Import #9 "./index_bg.js" "__wbg_error_53abcd6a461f73d8": function import requires a callable
at null.<anonymous> (shim.js:15:9)
✘ [ERROR] The Workers runtime failed to start. There is likely additional logging output above.[patch.crates-io]
wasm-bindgen = { git = "https://github.com/rustwasm/wasm-bindgen" }name = "<PROJECT_NAME>"
compatibility_date = "2024-11-22"
compatibility_flags = ["nodejs_compat"]
pages_build_output_dir = ".vercel/output/static"21:46:32.059 Found wrangler.toml file. Reading build configuration...
21:46:32.064 pages_build_output_dir: .vercel/output/static
21:46:32.065 Build environment variables: (none found)
21:46:32.162 Successfully read wrangler.toml file.
21:46:32.300 Detected the following tools from environment: npm@9.6.7, nodejs@18.17.1
21:46:32.300 Installing project dependencies: npm clean-install --progress=false
21:46:33.815 npm WARN EBADENGINE Unsupported engine {
21:46:33.815 npm WARN EBADENGINE package: 'next@15.0.3',
21:46:33.815 npm WARN EBADENGINE required: { node: '^18.18.0 || ^19.8.0 || >= 20.0.0' },
21:46:33.816 npm WARN EBADENGINE current: { node: 'v18.17.1', npm: '9.6.7' }
21:46:33.816 npm WARN EBADENGINE }
...
21:47:03.417 npm WARN EBADENGINE Unsupported engine {
21:46:33.417 npm WARN EBADENGINE package: 'next@15.0.3',
21:46:33.417 npm WARN EBADENGINE required: { node: '^18.18.0 || ^19.8.0 || >= 20.0.0' },
21:46:33.418 npm WARN EBADENGINE current: { node: 'v18.17.1', npm: '9.6.7' }
21:47:04.782 You are using Node.js 18.17.1. For Next.js, Node.js version "^18.18.0 || ^19.8.0 || >= 20.0.0" is required.
21:47:04.798 Error: Command "npm run build" exited with 1const cfPlatformProxy = await getPlatformProxy();
const db = drizzle(cfPlatformProxy.env.DB);
// Do some a few seconds long computation here...
const res = await db.select().from(myTable);const cfPlatformProxy = await getPlatformProxy();
let db = drizzle(cfPlatformProxy.env.DB);
// Do some a few seconds long computation here...
db = drizzle(cfPlatformProxy.env.DB);
await new Promise(resolve => setTimeout(resolve, 1500));
const res = await db.select().from(myTable);