Wrangler pages create project options

Is it possible from wrangler to create a project and specify the envars and the build command?
9 Replies
fernando
fernando12mo ago
I try running: wrangler pages project create test-local-5 -j=./wrangler.json Where wrangler.json contains the payload info listed in the API documentation https://developers.cloudflare.com/api/operations/pages-deployment-create-deployment When executing the command I don't get an error, but the project is not created with the builds command or the env_vars that I pass it.
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
fernando
fernando12mo ago
Cyb3r-Jak3
Cyb3r-Jak312mo ago
Pages doesn't use wrangler.toml so I'm pretty sure it is only possible to set variables an other items via the dashboard or API.
fernando
fernando12mo ago
what I was afraid of... @Cyb3r-Jok3 do you know which endpoint of the CF API consumes wrangler pages deploy? Or where could I see this info?
Cyb3r-Jak3
Cyb3r-Jak312mo ago
You can check the wrangler code itself to find the endpoints I believe it is in https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/src/pages/deploy.tsx
GitHub
workers-sdk/packages/wrangler/src/pages/deploy.tsx at main · cloudf...
⛅️ Home to Wrangler, the CLI for Cloudflare Workers® - workers-sdk/packages/wrangler/src/pages/deploy.tsx at main · cloudflare/workers-sdk
fernando
fernando12mo ago
Great! thanks @Cyb3r-Jok3
Cyb3r-Jak3
Cyb3r-Jak312mo ago
If you want to use the API to set deployment variables then you will need to use https://developers.cloudflare.com/api/operations/pages-project-update-project
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
fernando
fernando12mo ago
@Cyb3r-Jok3 I want to simulate what this command does:
wrangler pages publish --project-name=project_name -branch=branch_name ./apps/project_name/.next/server/app/
wrangler pages publish --project-name=project_name -branch=branch_name ./apps/project_name/.next/server/app/
But directly from the API to handle build cache issues and not always take so long. I'm going to manage the build from a github action and then through a CF API call I want to generate the deploy passing only the directory of the out put of the build. But I haven't figured out what wrangler pages publish does yet. Rather, I want to upload only the assets of the out put directory of my build command
Cyb3r-Jak3
Cyb3r-Jak312mo ago
When you do publish it uses direct upload https://developers.cloudflare.com/pages/platform/direct-upload/
Direct Uploads · Cloudflare Pages docs
Direct Uploads enable you to upload your prebuilt assets to the Pages platform and deploy them to the Cloudflare global network. This guide will …
Want results from more Discord servers?
Add your server
More Posts