Cloudflare Developers

CD

Cloudflare Developers

Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news

Join

Next 13.4.2, not-found.js, and 404's on Pages

Hi all - I have successfully been publishing pages w/ a Next.js setup for a few months and things are great, except.... With the new appDir setup on Next 13.4.2, I created a not-found.js file to return a custom 404 and not the Next default. On my local setup using npm run dev this works correctly and gives me my custom page. On Pages, it returns the Next default error message and not the custom page. ...

Create multiple Pages projects with a monorepo

I'm using a pnpm monorepo and it feels impossible to deploy multiple apps/projects from the same repo. Is there a way around it? For some context, I'd like to deploy a Sanity Studio app and my website which is based on SvelteKit. This is something possible with Vercel but I can't figure it out yet on CF Pages 😬...

"Unable to find pages project" error with GitHub Actions

I'm using the pages action to deploy my site from GitHub Pages. This is the part of the Action that defines the Pages deployment
- name: Deploy uses: https://github.com/cloudflare/pages-action@v1 with: apiToken: $ {{ secrets.CLOUDFLARE_API_TOKEN }} accountID: $ {{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: "website" directory: "dist" gitHubToken: $ {{ secrets.GITHUB_TOKEN }}
- name: Deploy uses: https://github.com/cloudflare/pages-action@v1 with: apiToken: $ {{ secrets.CLOUDFLARE_API_TOKEN }} accountID: $ {{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: "website" directory: "dist" gitHubToken: $ {{ secrets.GITHUB_TOKEN }}
...

CSS not updated.

i have my portfolio on Cloudflare pages, i updated my portfolio and it is updated to one url provided by cloudflare(in green) and not being updated on my custom domain(in red), what could be issue. any help`?

Error getting domain name working.

The browser gets an http 522 error, and when I tried to put a "Rule" in I got a Page Rule validation failed Code: 1004 I'm not understanding so many direct addresses to test page: https://cf01-3i7.pages.dev/ https://60f8e9ad.cf01-3i7.pages.dev I hit "retry deployment" and rec url below....

Nuxt (3.5.0) SSG rendered HTML differs on a custom domain.

Hi, I'm facing a rather weird issue where I don't really understand where it's coming from but am suspecting it has something to do with Cloudflare. Somehow the website content on my custom domain uwvloereruit.nl differs from uve-website.pages.dev. The content served by the custom domain is different (in a visually breaking way) while its is fully server side generated HTML. I have verified this difference by examining both response bodies with Postman. Specific components are somehow rerendered and comments indicating conditional renders are not present in the HTML returned by the custom domain which indicate to me this is not a Nuxt issue? I tried various possible solutions and non of them have worked....

Weird Pages NextJS build error

Cant really make it what is wrong with it, its quite a simple app, with nothing fancy going on aswell. Error logs are attached...

Error 522 when trying to setup a vanity domain via cf for saas

Hey I'm trying to setup vanity domains for my pages project, so that customers can use their own domain instead of a subdomain of my domain. I've added a custom domain in the SSL cf for saas panel (screenshot) but accessing this domain gives me a 522 error. How can I fix this? I've added the CNAME on the vanity domain to point to my fallback origin configured in the cf for saas panel...

One repository -> multiple pages projects

Hello 👋, I would like to ask if it is possible to create multiple Pages projects that would use the same repository. Basically what we want to achieve is that we want to have multiple Pages projects for one repository and every Pages project would be for different app environment with different branch to build and ENV....

help

i need help

Add another person to my Cloudflare page

Does anybody got any idea on how to give someone access to a cloudflare page? Everything seems to be account wide and no matter how many permissions I give they can't access the page I've given them access to the domain connected to the page in Cloudflare and added them as a collaborator on github, but they still can't see the project in my account pages section...

How to set up cloudflare to send an email (or emit some event) after page build is deployed?

I would like to be able to send an email after a page has been successfully deployed. Right now I have a github action that automatically merges any open PRs at a certain time. I've connected cloudflare pages to this github repo, and it automatically deploys the new PR, which is great, but I also want to get an update when that happens. Any ideas? Should I use /functions somehow? I saw cloudflare has an email service, but I couldn't understand how to make it work... https://blog.cloudflare.com/sending-email-from-workers-with-mailchannels/...

ERR_TOO_MANY_REDIRECTS -Tunnel is healthy

I need help setting up my new domain on Cloudflare tunnels . The connection is healthy, I can ping the subdomain but I can't see my local web app.

ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with ENOENT: node_modules/vite/bin/vite.js

I am using pnpm for my project. I already made the build command : npm install -g pnpm && pnpm i && pnpm build My environment is also using the following node version : NODE_VERSION 18.14.0...

Deploy a production vs preview build using GitHub Actions

I have a GitHub action setup to build a React project, then deploy using this GitHub action: https://github.com/marketplace/actions/cloudflare-pages-github-action When it deploys, it's deploying it as a preview build. How do I get it to deploy as a production build instead? The docs seem to indicate that I can specify which branch is the production branch, but I've looked all over the Page settings in CF and don't see that option. It seems to be missing....

required npm token is not working

Trying to build my Vue 3 (vitejs) single app. Added an NODE_VERSION environment set to 16.15.0. After deployment I see a npm ERR! Incorrect or missing password. error. I added my NPM token as NPM_TOKEN but not working. What to do

Middleware OK on `pages.dev`, not on custom domain?

I tried _middleware.js stuff with CF Pages, in an attempt to use it instead of an existing CF Worker. The middleware worked perfectly on the pages.dev version — but, on the custom-domain version from that pages.dev, only the HTML files were affected even though the middleware was supposed to apply for all routes and files (location: functions/_middleware.js, thus presumably for all routes). To be more specific: on the pages.dev version, a number of custom headers (such as for caching) were added to a variety of file types, including CSS and image files; but, on the custom-domain version, this worked for only the HTML files. Is there something special I have to do in the domain’s DNS, or elsewhere, to make the middleware work properly on the custom domain, too? (And I did remove the custom domain’s routes from the Worker for the test, so the Worker shouldn’t have been interfering.)...

nodejs_compat Compatability issue.

I'm trying to get nodejs compatability running using these instructions - https://developers.cloudflare.com/workers/platform/nodejs-compatibility/#enable-nodejs-from-the-cloudflare-dashboard From what I can see I've done this, screenshot attached. However, as per second screenshot, when the code is building it's still giving me the error about nodejs compatability....

robots.txt

Hi - I'm moving a previous wordpress site to a static site using pages and a cloudflare custom domain. I've added a robots.txt file to the files uploaded - when I visit mysite.com/robots.txt or mysite.com/anystring it's showing the index page - how do I stop that behaviour - I'd rather the user/crawler was served a 404 for mysite.com/anystring than the home page?