https://discord.cloudflare.com logo
Join Discord
Powered by
# pages-help
  • postinstall script is triggered too soon
    k

    kleinptr

    04/12/2023, 11:22 AM
    Hi I am facing an issue with deploying Nuxt to Cloudflare Pages via Nitro preset. It looks that during the build, Cloudflare trigger another job called "Installing dependencies" immediately when repo is cloned, but then it triggers my
    postinstall
    script which call
    nuxt prepare
    and it looks that not all deps are already installed at this moment so I am getting an error, especially with Pinia
    [error] Cannot find module 'pinia/dist/pinia.mjs'
    In my build command I'set install explicitly
    pnpm i && pnpm build
    so how can I prevent to trigger
    postinstall
    before my build command is called?
    v
    s
    • 3
    • 5
  • "Project not created! - An unknown error occured." Facing this error when creating Pages via API
    r

    rising_phoenix

    04/12/2023, 11:49 AM
    I am using Cloudflare API pages to host my customer's site. Recently I am getting the below error often "Project not created! - An unknown error occurred. Contact your account team or Cloudflare support: https://cfl.re/3WgEyrH."
    w
    • 2
    • 5
  • Has the temp directory location changed in the past week?
    i

    idrleon

    04/12/2023, 1:17 PM
    Our Jekyll build has started failing on an issue in the parent theme. If we rerun old (successful) builds from 6 days ago, they now fail. All versions of dependencies are the same in the successful builds 6 days ago compared to the unsuccessful ones today. I have traced it back to what I believe to be the temp directory now being set to
    /opt/buildhome/repo/
    . I believe this might have changed in the past 6 days. When Cloudflare builds:
    Copy code
    Remote Theme: Using theme pmarsceill/just-the-docs
    Remote Theme: Downloading https://codeload.github.com/pmarsceill/just-the-docs/zip/v0.2.7 to /opt/buildhome/repo/jekyll-remote-theme-20230412-14794-svae9e.zip
    Remote Theme: Unzipping /opt/buildhome/repo/jekyll-remote-theme-20230412-14794-svae9e.zip to /opt/buildhome/repo/jekyll-remote-theme-20230412-14794-j3aea2
    When building locally:
    Copy code
    Remote Theme: Using theme pmarsceill/just-the-docs
    Remote Theme: Downloading https://codeload.github.com/pmarsceill/just-the-docs/zip/v0.2.7 to /tmp/jekyll-remote-theme-20230412-93-vzhns2.zip
    Remote Theme: Unzipping /tmp/jekyll-remote-theme-20230412-93-vzhns2.zip to /tmp/jekyll-remote-theme-20230412-93-pdotqn
    Basically, when building in Cloudflare, the parent theme zip is downloaded inside the repo directory where its contents are seen as part of our site, which causes the build error. I've had to enable verbose mode to generate the above output so unfortunately can't see which directory was used when it was working without error 6 days ago. But obviously can see that it uses
    /tmp
    when we run the build locally.
    j
    j
    • 3
    • 9
  • How do I get Cloudflare Image resizing working with Cloudflare Pages deployment preview URLs?
    d

    DaveJ

    04/12/2023, 3:31 PM
    Is it possible to use Image resizing with Cloudflare Pages automatic deployment URLs? I want to be able to request an image like this...

    https://4222d427.my-website.pages.dev/cdn-cgi/image/width=48,height=48,f=auto/_app/immutable/assets/test-6fef8284.jpeg▾

    But currently, I need to merge to production before the image starts to work. Is there any way to get this working using the branch preview URL?
    v
    • 2
    • 2
  • SvelteKit - Error: The script will never generate a response
    b

    bim

    04/12/2023, 3:53 PM
    I'm getting quite a few errors with my app on Cloudflare pages with endpoints and load functions. I often get
    Error: The script will never generate a response
    or
    Error: Promise will never complete
    when navigating in the app to a page that loads data from a load function or endpoint. It seems to happen randomly but frequently, and when it does happen, if I refresh the page, the data will load properly. The same app deployed on Vercel works perfectly fine. Any ideas on what I may be doing wrong?
    v
    • 2
    • 1
  • Github Organization account not showing
    k

    Kithe

    04/12/2023, 4:22 PM
    I have connect my Github account which is the owner of the organization, also have already config the target repo with Cloudflare Pages. But I cannot find my organization account or target repo when creating a new project
    k
    • 2
    • 6
  • Custom domain not pointing at new website for some reason
    f

    Freedom

    04/12/2023, 10:59 PM
    So on my phone, I see:
    w
    • 2
    • 29
  • Can I versioning for production deployment?
    u

    심윤섭

    04/13/2023, 6:05 AM
    I'm using a webpage as a webview and I want to bugbear the webview and connect it to a custom domain. Is it possible to associate a custom domain with an individual deployed page like "release-1-0-1.mypage.com"? I'd like to automate this, and if it's possible, I'd like to know how to do it.
    v
    • 2
    • 1
  • Pages API for a site builder?
    p

    peter-lustig

    04/13/2023, 10:31 AM
    Hey, we want to build a site builder with Cloudflare pages and astro. The general plan is to create a Cloudflare account and host all the pages of the customers on there. There should be a button on the website which says "publish" and this should create a new cloudflare pages site or update the source code of a specific existing site. Would all of that be possible via the pages API?
    s
    • 2
    • 9
  • framework preset and build command keep changing randomly
    a

    amorfati

    04/13/2023, 12:15 PM
    I have an
    Astro
    website, I've set the framework preset 10 times, every time it changes to something else like in the pic. I tried redeploying, it keeps changing the choice I saved
    cleanshot-2023-04-13-at-05-14-31
    w
    • 2
    • 15
  • Robots.txt and sitemap.xml is not among 'Assets uploaded' with Pages build
    l

    Leftb

    04/13/2023, 12:23 PM
    We're using Pages to serve our static nextjs site. This works well except that we're seeing that our robots.txt and sitemap.xml, which are generated as part of our 'npm run export' command, are not uploaded. When I manually run the command on a clean directory, I'm seeing the two files in the 'out' directory that Cloudflare Pages uses. When running it on Cloudflare, the two files aren't part of the list of 'Assets uploaded', there's no error in the build output either. Does Pages specifically skip these files? Account id is 4ac4fa89909399132cbdfa6febacf36a, example build that doesn't include the files is 5406bfee
  • how do we deploy nextjs app with isr enabled?
    k

    krn

    04/13/2023, 5:23 PM
    i am trying to deploy a website with next js isr but it is not deploying the website properly. do i have to use service worker or i am missing some version or setting? fyi: its an blog site & build is not showing any articles
    b
    • 2
    • 8
  • Custom domain won't stop verifying
    c

    Cole Xemi

    04/13/2023, 5:38 PM
    I have a custom domain setup for my pages app, the custom domain works for the app, the issue is that under the custom domains tab for the page it is stuck on "verifying" for the custom domain
    w
    • 2
    • 3
  • Does pages support Next.js rewrites?
    y

    ysmdev

    04/13/2023, 7:15 PM
    Does pages support Next.js rewrites in next.config.js?
    b
    • 2
    • 7
  • Upload of large static site fails when using wrangler
    s

    Shervanator

    04/14/2023, 5:26 AM
    I'm currently trying to upload some changes to one of our static sites using the following command:
    Copy code
    npx wrangler pages publish /output --project-name xxx --branch=staging
    This was working fine, but recently we have added more files to the site and its now failing. It was around 2500 files before, and now its ~5000. The error I am getting is the following:
    Copy code
    🌍  Uploading... (444/5248)
    
    /Users/xxxxx/.npm/_npx/xxxxx/node_modules/wrangler/wrangler-dist/cli.js:30488
                throw a;
                ^
    
    FatalError: Failed to upload files. Please try again. Error: {"cause":{"name":"HeadersTimeoutError","code":"UND_ERR_HEADERS_TIMEOUT","message":"Headers Timeout Error"}})
        at /Users/xxxxx/.npm/_npx/xxxxx/node_modules/wrangler/wrangler-dist/cli.js:145514:13
        at async run (/Users/xxxxx/.npm/_npx/xxxxx/node_modules/wrangler/wrangler-dist/cli.js:145120:26) {
      code: 1
    }
    Our files are all under the limits detailed here: https://developers.cloudflare.com/pages/platform/limits/ Unless I am interpreting
    The maximum file size for a single Cloudflare Pages site asset is 25 MiB.
    wrong? Our whole site is bigger than 25 MB, but there is no individual asset that is bigger than 25 MB. If anyone has any ideas that would be very helpful! 😄 account id: 8c9ee80785ec7bd960920b7d4a2a63c0
    z
    • 2
    • 6
  • Cloudflare Images Custom Domains - BUG?
    k

    King Mesal

    04/15/2023, 3:56 PM
    BUG ALERT 🪲 I see in the docs https://developers.cloudflare.com/images/cloudflare-images/serve-images/serve-images-custom-domains/ it says: > Serve images from custom domains I have use cases that are failing with a
    403
    when using CF Images service via this URL format: > https://mycustom.domain/cdn-cgi/imagedelivery/ Details: 1. I have my sites in pages. 2. I have a bunch of images stored in images. 3. I know the problem has to do with DNS (custom domains). 4 I have a 2 custom domains that this URL path works just fine > One of the two is a CNAME from another DNS provider. All good. One is CNAME flattening in the same CF account. 4 It does not work 2 of the custom domains > Both DNS are managed in other cloudflare accounts with CNAME flattening and one example with subdomain CNAMEs pointing at the pages.dev project. 5. If I use the pages.dev url of my pages projects all the images load just fine. 6. All the SSL certificates are setup, valid, enabled... Some custom domains working and other failing, but the most baffling part is the case where the subdomain managed in another DNS provider works. But those managed via other cloudflare accounts do not. Is this a 🐛 ❓
    u
    • 2
    • 4
  • access remote KV namespace during local development?
    j

    jeffo

    04/15/2023, 9:31 PM
    has anyone been able to access remote KV namespaces from their local development environment? the documentation on this is a mess, and i feel i've exhausted all of the configuration options without success. i want to get a value from the preview version of the KV namespace i created for a pages app. the deployed code works fine, but i want to be able to test locally without constantly deploying. the following code and configs are my best guess at what the documentation is telling me to do, but it's not working. 1. function code
    Copy code
    interface Env {
      SCORES: KVNamespace
    }
    
    export const onRequestGet: PagesFunction<Env> = async (context) => {
      const foo = await context.env.SCORES.get('foo')
      return new Response( foo )
    }
    2. kv namespace config in workers
    Copy code
    $ $(yarn global bin)/wrangler kv:namespace list
    
    [
      {
        "id": "...",
        "title": "MY_KV_SCORES",
        "supports_url_encoding": true
      },
      {
        "id": "...",
        "title": "MY_KV_SCORES_preview",
        "supports_url_encoding": true
      },
    ]
    3. kv binding in pages - Variable name: SCORES - KV namespace: MY_KV_SCORES_preview 4. running local dev environment command:
    Copy code
    wrangler pages dev ./dist --experimental-local --kv=SCORES
    output:
    Copy code
    Your worker has access to the following bindings:
    - KV Namespaces:
      - SCORES:
    5. if i create a
    wrangler.toml
    with this content:
    Copy code
    kv_namespaces = [
      { binding = "SCORES", id = "...", preview_id = "..." }
    ]
    then i get this output:
    Copy code
    Your worker has access to the following bindings:
    - KV Namespaces:
      - SCORES: 058...
      - SCORES:
    BUT NO MATTER WHAT – i never get the value i get when i call `wrangler kv:key get`:
    Copy code
    $ wrangler kv:key get foo --binding=SCORES ; echo
    production
    
    $ wrangler kv:key get foo --binding=SCORES --preview ; echo
    preview
    when i call the function, just get a null value. 🤔
    g
    t
    +2
    • 5
    • 8
  • NextJs Deployment Help! Cannot find module 'node:buffer'
    s

    steve

    04/16/2023, 2:12 PM
    Unable to deploy Nextjs to Cloudflare pages, failing at next build and gives this error
    Cannot find module 'node:buffer'
    Works fine on local machine, build is successful and exports the build to
    .vercel/
    folder
    s
    • 2
    • 2
  • List/revoke wrangler oauth tokens
    p

    peter7a

    04/17/2023, 8:19 AM
    Hello. I have several wrangler oauth authorizations for my pages project. I'd like to see a list and maybe revoke them, but I do not see them in oauth tokens or anywhere else I searched.
  • Deploy Remix app to Cloudflare Pages
    i

    ishan02016

    04/17/2023, 9:24 AM
    Needs Help I have choose Cloudflare to deploy my Application. I want a production preview URL so i can see my App with a link. I deployed my Remix starter app (for now) with the official documentation Deploy Remix documentation page. But I get this error in Build log
    remix: not found
    Help needed!
    z
    • 2
    • 3
  • Where are Durable Object classes supposed to live? Getting error: ERR_CLASS_NOT_FOUND
    d

    dkfdkdodkms

    04/17/2023, 5:48 PM
    I cannot get durable object bindings to work using --do=foo=FooBar. I get the error DurableObjectError [ERR_CLASS_NOT_FOUND]: Class "FooBar" for Durable Object "foo" not found
    h
    s
    • 3
    • 57
  • how do you run npm install --force in cloudflare pages?
    s

    serps

    04/17/2023, 7:02 PM
    I am trying to run qwik but my build requires me to use npm install --force, any ideas? thanks
    h
    w
    j
    • 4
    • 16
  • New Pages sites - Error Code 522
    r

    rusticXploit

    04/18/2023, 1:33 AM
    When I create a new pages site and navigate to the pages.dev URL I get a 522 back. I've tried deleting and re-creating a new project 3 or 4 times; by connecting it to Github and uploading the static files with the same result. The build and deploy process succeeded. I've tried adding a "custom domain" waiting for the custom domain to verify and I get the same result. I thought things might just be a little slow but my last successful deployment was 2 hours ago and I'm still receiving the same error.
    w
    • 2
    • 2
  • Can't connect to github
    o

    Or

    04/18/2023, 6:33 AM
    Hi, I'm trying to connect pages to github, but after I'm getting back from github to cloudflare I get the following error: An unknown error occured. Contact your account team or Cloudflare support: https://cfl.re/3WgEyrH. (Code: 8000000) Any ideas how to solve it?
  • All of a sudden redirecting to index.html leading to "too many redirects"
    q

    quambo

    04/18/2023, 8:24 AM
    We're hosting our pages on CF workers. Yesterdays deployments of our SPA are good, all of todays deployments suddenly give "too many redirects". Our _redirects file
    Copy code
    /* /index.html 200
    Our deployment from 15h ago https://40f40083.console-ey3.pages.dev/ Our deployment of today https://4cedd8d6.console-ey3.pages.dev/ It keeps on redirecting to index.html and loops on there. We have made no changes to our config.
    w
    z
    j
    • 4
    • 7
  • Can't deploy Pages site
    j

    jamuse

    04/18/2023, 11:20 AM
    I'm getting repeated errors building my pages site, e.g. deployment ID: 19739eda-8519-4492-943d-87c93f56d1b1. I posted some example error messages here: https://pastebin.com/Bt0Lv98K Any ideas how I can fix this?
  • How to delete a durable object?
    v

    Vero 🐙

    04/21/2023, 8:26 AM
    Hey, please move this question to #773219443911819284, since this isn't related to pages
  • Pages - Failing to deploy pages site that does not contain CF Functions
    e

    elijah

    04/18/2023, 5:23 PM
    We are seeing some odd errors after a the build and upload steps are both successful:
    Copy code
    Success: Assets published!
    Error: Failed to publish your Function. Got error: Unknown internal error occurred.
    Our project does not contain any functions that are to be published, any help is greatly appreciated.
    s
    w
    • 3
    • 12
  • next.js SSR, Edge API Routes 404s
    b

    botabit

    04/18/2023, 5:50 PM
    I'm trying to use edge API routes https://nextjs.org/docs/api-routes/edge-api-routes with edge rendering (getServerSideProps), however when sending a request to a deployed instance the API routes 404, but the rendered pages don't.
    next.config.js
    Copy code
    js
    /** @type {import('next').NextConfig} */
    const nextConfig = {
      reactStrictMode: true,
      experimental: {
        runtime: "experimental-edge",
      },
      rewrites: () => [
        {
          source: "/test.txt",
          destination: "/api/test",
        },
      ],
    };
    
    module.exports = nextConfig;
    /api/test.ts
    Copy code
    ts
    function generateText(adsTxt: any) {
      return adsTxt;
    }
    
    export const config = {
      runtime: "edge",
    };
    
    export default async function handler(req: any) {
    
      return new Response(generateText('test'), {
        status: 200,
        headers: {
          "Content-Type": "text/text",
        },
      });
    }
    Pages.dev id
    6e6ad55030ab3f7f2045eccf0d33501c
    b
    s
    • 3
    • 35
  • Problem with renaming gitlab project
    e

    enigmatix

    04/18/2023, 5:50 PM
    I created a Pages project linked to gitlab/A. The integrations worked fine, until I renamed project A to project B in gitlab. Now, when I do a git push to gitlab/B, the pipeline fails. The Pages build log says it fails to access gitlab/A. Apparently it's impossible to revoke or modify this access to gitlab/A, and when I try to create a new project to connect to gitlab/B, it says it's busy. What's my option?
12345...9Latest