https://discord.cloudflare.com logo
Join Discord
Powered by
# pages-help
  • Cloudflare pages deployment stop working all of sudden
    l

    LTroya

    04/18/2023, 9:35 PM
    Hi guys, Is there anyone having problems with Cloudflare pages deployments? It has been failing for the last 20 minutes or so throwing the error I showed in the image. Any hint or suggestions to try would be much appreciated!
    i
    c
    • 3
    • 5
  • sveltekit deployment error
    n

    nate!

    04/19/2023, 3:52 AM
    hello
    c
    • 2
    • 60
  • Error with pnpm and Next 13.3
    o

    O Rato

    04/19/2023, 4:24 AM
    Hi, we are having an issue with building pages on next 13.3 We are having an error where it says that pnpx was not found. Same issue reported in the end of february. We had success in building without the pnpm lock file. https://discord.com/channels/595317990191398933/1077873714248560710 We are also seeing some issues with the new appDir routing, our pages are giving us 404, but we are not sure it's related to pages.
    b
    g
    • 3
    • 7
  • I'm trying to deploy a Next.JS app and my API routes keep returning 404 HTML instead of JSON
    s

    semistrict

    04/19/2023, 5:17 AM
    I have added the edge runtime in my next.config.js like this:
    Copy code
    /** @type {import('next').NextConfig} */
    const nextConfig = {
      reactStrictMode: true,
      runtime: "edge"
    }
    
    module.exports = nextConfig
    Not sure what else to try here.
    b
    • 2
    • 1
  • Build not finishing,... 15 minutes into the build
    j

    jdkdev

    04/19/2023, 3:36 PM
    Getting issues at node 16 step. See image for logs. It keeps repeating the same thing. Anyone know if there are current issues with Cloudflare? Thanks,
    s
    • 2
    • 3
  • Using private NPM packages in with cf-pages
    m

    MagnusIntergiro

    04/19/2023, 7:25 PM
    I'm working on a cf-pages that uses private npm packages, from it's own registry. To have it working locally for me, by having added a personal access token from github as
    NPM_AUTH_TOKEN
    in my
    .bashrc
    . And the registry is set in
    .npmrc
    in the repo, so that should be fine. But I don't know where to add the
    NPM_AUTH_TOKEN
    for the cf-pages to install and build?
    c
    • 2
    • 1
  • Direct upload @cloudflare/next-on-pages project
    s

    sizumita

    04/20/2023, 2:36 AM
    Can I upload @cloudflare/next-on-pages output by direct upload? I ran
    npx @cloudflare/next-on-pages --experimental-minify
    and
    CLOUDFLARE_ACCOUNT_ID=xxx npx wrangler pages publish .vercel/output/static --project-name yyy
    but it causes deploy error (failed) without any error text.
    Copy code
    account id: 145418bdc7871190e993bb8083b0c02c
    deploy id: None
    b
    • 2
    • 2
  • Send feedback mail after contact form submission
    g

    Grentenville

    04/20/2023, 12:56 PM
    I'm trying to know if it would be possible to send a feedback email after the user use the contact form. I got it working by following this blog post: https://blog.cloudflare.com/sending-email-from-workers-with-mailchannels/ I can use the form successfully and the email is sent to me, but I would like to know if it would be possible for the user to receive one email after using the contact form. It is my first time working with Cloudflare Pages and Functions, so I'm not really into the capabilities and how everything works exactly
    z
    • 2
    • 4
  • How often is the counter updated?
    e

    Evil Morty

    04/21/2023, 12:17 AM
    Hello, How often is the bundled requests counter updated?
    j
    • 2
    • 1
  • [solid-start-cloudflare-pages] making http request inside createServerData$
    a

    AllanGalera

    04/21/2023, 6:22 AM
    Hi 😁 I'm new to cloudflare and I'm trying to make an http request. When I use a library like
    got
    it works fine locally but when I deploy I get that it needs
    nodejs_compat
    . I tried adding in the UI at settings > function > compatibility flags but didn't work. When I use fetch it fails locally with a
    fetch failed
    with something about a
    new ReadableStream()
    (will get a more detailed error when I revert to this scenario). Tell me if there any other necessary information 😁 But the main question is: What is the proper way to make a http reauest inside a
    createServerData$
    ?
    s
    • 2
    • 22
  • How to force deploy?
    r

    rkarmark

    04/21/2023, 6:40 PM
    I am trying to deploy a blazor webassembly app on Pages. This has worked fine in the past, but now I am using NPM packages, that I use on my personal machine but are not required for the build. This seems to have messed with the build finished trigger, so the app no longer deploys, even after having being build correctly. My current build command is:
    Copy code
    bash
    curl -sSL https://dot.net/v1/dotnet-install.sh > dotnet-install.sh; chmod +x dotnet-install.sh; ./dotnet-install.sh -c 7.0 -InstallDir ./dotnet7; ./dotnet7/dotnet --version; ./dotnet7/dotnet publish -c Release;
    Is there some command to let cloudflare know that if you reach this, then deploy it?
  • Why does the seek bar on videos not work as a discord embed if its mp4 or webm?
    h

    Hubchicken

    04/22/2023, 5:04 AM
    I am hosting a site on Pages that has a couple of videos, when embedding them to Discord the seek bar does not work unless the video is a .mov. mp4's seek bar works fine on the site itself if you watch it atleast once, but does not apply to discord embed an example of this is hubvideos.pages.dev/ADBREAK.mp4, if you embed this video onto discord the seek bar simply does not work
    s
    e
    • 3
    • 8
  • Web requests not being received from Pages
    e

    Erisa | Support Engineer

    04/22/2023, 1:42 PM
    If you open your browsers devtools (press F12) and refresh the page, do you see any errors in the Console or Network tabs?
    n
    • 2
    • 1
  • Is it possible to use react fast refresh with next-on-pages?
    m

    MemeMan

    04/22/2023, 4:02 PM
    Hi, I'm using
    next-on-pages --watch
    locally along with
    wrangler pages dev .vercel/output/static/ --persist --d1 DB
    - this works so that I can use the D1 binding but I lose the ability to use fast refresh and have to manually reload the browser to pick up any react changes. Is there any way to use
    next-on-pages
    in a way so that fast refresh can work while still rebuilding
    _worker.js
    on change as well?
  • access the cloudflare runtime in an astro js/ts endpoint?
    j

    jeffo

    04/23/2023, 2:07 AM
    i've been trying to figure out the answer to this question for a couple days. the obvious answer finally dawned on me today, but since it's not in the @astrojs/cloudflare documentation, i want to share it here to save others time. if you're writing an astro endpoint in javascript or typescript, and want to access the cloudflare runtime, the example code doesn't work:
    Copy code
    import { getRuntime } from "@astrojs/cloudflare/runtime";
    getRuntime(Astro.request);
    from https://docs.astro.build/en/guides/integrations-guide/cloudflare/#access-to-the-cloudflare-runtime this sample code only works in
    .astro
    files where
    Astro
    is globally defined. instead, use the following to get access to the cloudflare runtime in a typescript endpoint:
    Copy code
    import type { APIContext } from 'astro'
    import { getRuntime } from "@astrojs/cloudflare/runtime"
    
    export async function get( context: APIContext ) 
    {
      const rt = getRuntime( context.request )
      ...
      const id = context.params.id
      const val = await rt.env.MY_KV.get( id )
      ...
    }
    logging
    rt
    here will look something like this:
    Copy code
    rt = {
      functionPath: '/foo.json',
      params: [Object: null prototype] { path: [Array] },
      data: {},
      env: {
        MY_KV: KVNamespace {},
        ASSETS: Fetcher {},
        SITE: 'https://example.com',
        BASE_URL: '/hello',
        FOOBAR: 'SNAFU'
      },
      waitUntil: [Function: bound waitUntil],
      passThroughOnException: [Function: passThroughOnException],
      name: 'cloudflare',
      next: [AsyncFunction: next]
    }
    in my local dev environment, the bindings in
    rt.env
    from: 1.
    .dev.vars
    Copy code
    SITE="http://example.com"
    BASE_URL="/hello"
    FOOBAR="SNAFU"
    2.
    wrangler.toml
    Copy code
    kv_namespaces = [
      { binding = "MY_KV", id = "...", preview_id = "..." }
    ]
    hope this helps someone!
    s
    s
    • 3
    • 6
  • Custom domain is "Inactive (error)"
    s

    Simon Thorpe (securitypedant)

    04/23/2023, 5:58 AM
    I've just gone through the Remix deployment guide on pages and successfully deployed a very simple app. It built fine and is accessible via the .page.dev hostname. https://www-thorpevillage-com.pages.dev I then went to add a custom domain. thorpevillage.com is hosted by Cloudflare, so I added wwwtest.thorpevillage.com. Looking at the domain I can see that Cloudflare has automatically created a CNAME record that is proxied through Cloudflare and is pointing correctly to www-thorpevillage-com.pages.dev. However when I visit that URL, I get a Cloudflare error page (attached). If I look at the custom domain in my pages project, it shows as "Inactive (error)". I've read https://developers.cloudflare.com/pages/platform/custom-domains/ and cannot see anything obvious that might be causing this error. Anyone know what's going on?
    w
    • 2
    • 6
  • Cloudflare dynamic redirects localization?
    u

    .Zero

    04/24/2023, 6:07 AM
    Hello there, im trying to achieve that my users are redirected to mydomain.com/(en/de/fr) etc based on their accept-language header I want to say for example the 3 above are "allowed" and all others go to "en" but then if someone goes to /de that has en headers it should still work and not redirect to /de/en or something. I think this would require 2 dynamic redirect rules
    h
    • 2
    • 9
  • Host Files instead of whole website
    c

    cerberus

    04/24/2023, 10:14 AM
    Is it possible use the CDN to hold certain files so someone can link them in a different place aka via HTML link property in PHPBB.
    v
    g
    • 3
    • 3
  • curious case of .js files that contain dashes and are served as html from a pages.dev site
    k

    kajtzu

    04/24/2023, 10:16 AM
    I noticed a curious case where, when vite generates files that are foo-blah.extension, the files are served with the wrong mime type. For example assets/index-424242.js is served with mime-type text/html. What I do is build + package somewhere else (in CI) and then use
    npx wrangler pages publish build --project-name=
    to deploy to CF. Reading the forums it seems that many others have stumbled on the same problem 2021 and 2022 without it getting fixed, it seems. So I added a _headers file which overrides the content-type for
    /*.js
    and
    /*.css
    correctly because modern browsers tend to be picky and they do not want to execute .js files unless the mime type is correctly set. This part works but it is really annoying to have to do that. While troubleshooting this, I noticed an even curiouser case where if I request /index.html I get the file as one would expect, but if I request /assets/index-424242.js I get, instead of the uploaded javascript, file the contents of the top level index.html instead. This obviously breaks everything. Now, as I build elsewhere, I can prove (to myself) that vite+swc built everything correctly and that there really is a 4.5 MB assets/index-424242.js file in the build root. If I deploy the static javascript stuff to a regular nginx instance anywhere I get the correct files and that's that. Recap: - I build and package outside CF - I use wrangler to upload - There aren't any functions, I have assumed pages.dev is simply a place that serves files that were uploaded there - The entire site consists of html, js, svg, css assets Any ideas on where to start? Any pointers welcome, of course...
    s
    • 2
    • 2
  • Can't I configure the git repository when creating a Page Project using the API
    a

    anhoder

    04/24/2023, 10:16 AM
    I would like to use https://api.cloudflare.com/client/v4 /Accounts/{account_identifier}/pages/projects to create a Page Project, but why can't it configure the git repository, or haven't I found it yet?
    w
    • 2
    • 13
  • Cloudflare Access on Custom Domains
    v

    Valorian

    04/24/2023, 10:56 AM
    I have had a pretty bad experience deploying Cloudflare Pages to a custom domain hosted on Cloudflare so far. My goal is to upload a page and restrict access to that page with Cloudflare Access. I'm uploading the pages with direct upload, it is then deployed in three locations: -
    xxx.test.pages.dev
    -
    test.pages.dev
    -
    page.test.xyz
    (custom domain) Then I create two Cloudflare Access applications and limit their access to a bunch of emails with the One-Time PIN authentication provider: -
    xxx.test.pages.dev
    -
    test.pages.dev
    This works well so far, including the limited access in the custom domain. The issue is that files aren't covered by Cloudflare Access on the custom domain, e.g.
    page.test.xyz/file.js
    is not protected by Cloudflare Access. I tried creating a third Cloudflare Access application at
    page.text.xyz/*
    , which does protect files, but breaks the page with endless redirections. The post guidelines say to include links and IDs, which unfortunately I can't do publicly, but if necessary I can create a reproduction of this problem with some example files I can actually show.
    c
    • 2
    • 4
  • WAF rules block custom domain verification
    c

    clem.one

    04/24/2023, 2:07 PM
    So I have a pages setup with a custom domain. Within the custom domain I setup WAF to block non EU continent requests. In the events I see that there are coming requests to the customer domain from CF to validate the custom domain / DNS setup. I tried to exclude by the useragent and URI but nothing seems to work es exception. Is there a different approach in order to allow CF to validate the custom domain? I now disabled temporarily the block rule to have it done. solax-t58-gen-check.pages.dev accountID: 1573836d180be7e4aa3e975e692ae0b1
  • MIME Type _headers help needed
    m

    Migmac

    04/25/2023, 4:53 PM
    I am trying to get a
    Unity WebGL
    build to deploy on pages and I can't seem to get the
    _headers
    file right I need the following files to be functional
    Copy code
    /Build/BUILD.data.gz
    /Build/BUILD.framework.js.gz
    /Build/BUILD.loader.js
    /Build/BUILD.wasm.gz
    I have tried messing around with the
    _headers
    file to no success My current
    _headers
    file looks like this:
    Copy code
    /*.gz
      Content-Encoding: gzip
    
    /*.data.gz
      Content-Type: application/octet-stream
    
    /*.wasm.gz
      Content-Type: application/wasm
    
    /*.js
      Content-Type: application/javascript
    
    /*.js.gz
      Content-Type: application/javascript
    I do get the following error message when trying to load the page though:
    Copy code
    Unable to parse Build/BUILD.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: gzip" present. Check browser Console and Devtools Network tab to debug.
    Any help would be useful. Thanks in advance
  • Confirm SSL will work before adding the CNAME when using the My DNS provider option.
    a

    AJ | Aklivity.io

    04/25/2023, 9:28 PM
    My boss is wanting me to test to make sure lets-encrypt will work before they update the CNAME record. Is there a way to do this?
    w
    • 2
    • 4
  • Can _routes.json exclude paths from _middleware.js?
    c

    cornelius

    04/25/2023, 11:45 PM
    The reason I ask is that my image resizing URLs are failing with the error: Error 9524: image could not be resized (502) Which the troubleshooting guide suggests: "9524 — /cdn-cgi/image/ resizing service could not perform resizing, probably because the image URL was intercepted by a Worker." I'm pretty new to workers and cloudflare functions. I do indeed have a middleware file in the /functions directory in my pages project. But I also have a _routes.json file that should be excluding images, no? { "version": 1, "include": ["/*"], "exclude": ["/images/*"] }
    w
    • 2
    • 4
  • LetsEncrypt through Cloudflare Proxy
    t

    thornAvery

    04/26/2023, 4:20 AM
    Hello, Im trying to deploy a server who's URL is proxied via Cloudflare. I can ssh to it through the tunnel, however my LetsEncrypt is failing to register. I'm unsure what the best way to allow this through is, I have added the server to a cloudflare tunnel, added the http/s options in the zero access "public hostname" entry, and added a page rule to disable SSL on the .well-known/acme-challenge route, to no avail. What else should I try? Thank you
    h
    • 2
    • 7
  • Cloudfare & Github
    s

    skirt

    04/26/2023, 12:42 PM
    I updated my site on github and i went to cloudfare to check if it went through on cloudfare pages and it still says last update 19 hours ago
    v
    • 2
    • 1
  • Error: Failed to publish your Function. Got error: Unknown internal error occurred.
    l

    luc122c

    04/26/2023, 2:59 PM
    One of my builds had the following error:
    12:55:06.007 Error: Failed to publish your Function. Got error: Unknown internal error occurred.
    Seems like a one off and it's fine now, just thought I'd flag it.
    s
    • 2
    • 3
  • websocket abruptly closes
    r

    rodbs

    04/26/2023, 4:03 PM
    I'm using MS cognitive services with CloudFlare Pages and the websocket connection closes before covnerting text to audio and generting the file:
    Copy code
    console.log(sdk.Diagnostics.SetLoggingLevel(sdk.LogLevel.Debug));
    
      const prom = new Promise((resolve, reject) => {
          const synthesizer = new sdk.SpeechSynthesizer(speechConfig, null);
    
        synthesizer.speakSsmlAsync(
          ssml,
          async (result) => {
            console.log('RESULT', result);
            if (result.errorDetails) {
              console.log('1 if ');
              console.log('ERROR', result.errorDetails);
              synthesizer.close();
            } else {
              console.log('2 if');
              const file = new File([result.audioData], fileName, {
                type: 'audio/mp3',
                lastModified: Date.now()
              });
              const res = await context.env.R2_IGLSBKT.put(fileName, file);
              console.log('res R2', res);
              synthesizer.close();  
              resolve(fileName);
            }
          },
          (error) => {
            console.log('err', error);
            synthesizer.close();
          }
        );
      });
      
      await context.waitUntil(prom);
    I got this error:
    Copy code
    (log) ERROR websocket send error: Websocket not ready 7E9767F5499D4D44AB1AEADF2328152C DA30C36F329148D58231F50472556959 Error
        at $e.sendRawMessage (functionsWorker-0.04974505925468953.js:33452:129)
        at $e.<anonymous> (functionsWorker-0.04974505925468953.js:33474:22)
        at Generator.next (<anonymous>)
        at c (functionsWorker-0.04974505925468953.js:33336:13)
    My understanding is that
    WaitUntil
    kept the task running in the background until completion. Why then does the ws end before completion? How can I keep running in the background? (I'm in Unbound mode)
    v
    h
    • 3
    • 12
  • Settings for production branch
    l

    luddilo

    04/28/2023, 11:44 AM
    The docs at https://developers.cloudflare.com/pages/platform/git-integration/ implies that there are some settings to configure production deployments. I don't see this option in the settings (see img). How can I configure this?
    s
    • 2
    • 4
12345...9Latest