https://discord.cloudflare.com logo
Join Discord
Powered by
# pages-help
  • next-on-pages + Cloudflare bindings
    v

    vitaly

    05/26/2023, 9:28 AM
    Is there any way of generating edge routes from next-on-pages that have access to the cloudflare bindings?
  • Can't visit Webside
    n

    Nepollo

    05/26/2023, 12:32 PM
    I cant visit my webside...

    https://cdn.discordapp.com/attachments/1111632845321019473/1111632876962852954/image.png▾

    h
    c
    • 3
    • 28
  • 20k requests without sharing website with anyone
    e

    Eamag

    05/26/2023, 3:05 PM
    can someone help me to understand why my Database egress is gone so quickly? I deployed a simple sveltekit+supabase app to view most popular messages in my slack community to cloudflare, shared it with 5 people (my google analytics and cloudflare analytics show only 10 unique users but cloudflare shows 18k total requests from random countries) but I also enabled full caching and 11k of these requests are cached. Is there some sveltekit/supabase/cloudflare interaction that evades caching?
    c
    • 2
    • 1
  • Forward Build Logs?
    i

    IDisposable

    05/26/2023, 3:57 PM
    We've got a corporate CloudFlare instance with some GitHub-driven CloudFlare pages projects. Would like to be able to allow either the link in the build report (what's shown in GitHub Conversation for a PR) to allow NOT-ADMIN USERS to see the build logs to debug stuff... really don't want our developers to have to have CloudFlare accounts to see the build logs. Is there a way to have the logs visible on the link specified, or is is possible to have it push the build log somewhere (an GitHub issue, email it, whatever)?
    e
    • 2
    • 2
  • Is it possible to connect to D1 from Next.js App hosted on Cloudflare pages?
    i

    iCode

    05/27/2023, 8:20 PM
    I have a simple next.js 13 app (typescript) which needs to perform CRUD operations on D1. Currently, I only saw docs for connecting from workers. Is it possible from next.js? also, what about local development?
    b
    • 2
    • 1
  • Cannot link github
    t

    theMackabu

    05/28/2023, 1:14 AM
    Account ID:
    90e573cb19849ba7d4a553766544b9b0
    When I try to link my new github account to cloudflare, it fails to link. There is no error, but it does not appear in the dropdown when creating a new pages site. Ive also tried unlinking and relinking to no avail? (Problem seems very similar to https://discord.com/channels/595317990191398933/789155108529111069/1056577433261854720 for reference)
    • 1
    • 1
  • How to handle private assets with Cloudflare Pages & GitHub?
    p

    psm

    05/28/2023, 10:04 PM
    I'm making a website that uses licensed fonts that I obviously can't distribute, but I want the rest of my site to be open source (I'm using a GitHub repository). I have the folder with the fonts in my
    .gitignore
    , but the fonts need to get to Cloudflare somehow. I currently have Cloudflare set to deploy my site from the GitHub repo, but I can't upload the fonts to GitHub, so how should I deploy my site instead?
    c
    • 2
    • 1
  • Error deploying nuxt
    f

    fantucifq

    07/31/2023, 11:11 PM
    Hey everyone. I'm trying to deploy a nuxt app in Cloudflare Pages, but im getting the following error when running the build command:
    Copy code
    [error] Cannot resolve "canvas" from "/opt/buildhome/repo/node_modules/.pnpm/linkedom@0.15.1/node_modules/linkedom/commonjs/canvas.cjs" and externals are not allowed!
          at Object.resolveId (node_modules/.pnpm/nitropack@2.5.2/node_modules/nitropack/dist/shared/nitro.7a525996.mjs:1781:17)
          at async PluginDriver.hookFirstAndGetPlugin (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:25256:28)
          at async resolveId (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:23931:26)
          at async ModuleLoader.resolveId (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:24345:15)
          at async node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:778:16
          at async Promise.all (index 0)
          at async node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:770:32
          at async rewriteRequireExpressionsAndGetImportBlock (node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:1346:28)
          at async transformCommonjs (node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:1909:23)
          at async transform (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:24263:16)
    has anyone seen a similar error? Using Node 18.16.1 and nuxt 3.6.5
    c
    • 2
    • 1
  • Nuxt JS on Pages environment variables not working
    u

    .crossbeau

    08/17/2023, 12:07 AM
    I have correctly set all my env vars, my code seems accurate as far as i can tell yet no matter what i do pages will not use my variables
    c
    • 2
    • 5
  • vercel/og missing .wasm files
    p

    p7m

    08/26/2023, 6:44 PM
    When using the vercel/og pages plugin I get this error:
    Copy code
    ✘ [ERROR] 2 error(s) and 0 warning(s) when compiling Worker.
    20:36:18.056    
    20:36:18.056    
    20:36:18.059    
    20:36:18.061    ✘ [ERROR] [plugin wrangler-module-collector] ENOENT: no such file or directory, open '/opt/buildhome/repo/node_modules/@vercel/og/dist/resvg.wasm?module'
    20:36:18.061    
    20:36:18.062        ../node_modules/@vercel/og/dist/index.edge.js:9:23:
    20:36:18.062          9 │ import resvg_wasm from "./resvg.wasm?module";
    20:36:18.062            ╵                        ~~~~~~~~~~~~~~~~~~~~~
    20:36:18.062    
    20:36:18.062      This error came from the "onResolve" callback registered here:
    20:36:18.063    
    20:36:18.063        ../../../pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:124157:19:
    20:36:18.063          124157 │             build5.onResolve(
    20:36:18.063                 ╵                    ~~~~~~~~~
    20:36:18.063    
    20:36:18.063        at /opt/pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:124157:20
    20:36:18.063        at Array.forEach (<anonymous>)
    20:36:18.063        at /opt/pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:124156:22
    20:36:18.064        at Array.forEach (<anonymous>)
    20:36:18.064        at setup (/opt/pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:124153:16)
    20:36:18.064        at handlePlugins (/opt/pages/build_tool/js/node_modules/wrangler/node_modules/esbuild/lib/main.js:1276:21)
    20:36:18.064        at buildOrServeImpl (/opt/pages/build_tool/js/node_modules/wrangler/node_modules/esbuild/lib/main.js:965:5)
    20:36:18.064        at Object.buildOrServe (/opt/pages/build_tool/js/node_modules/wrangler/node_modules/esbuild/lib/main.js:773:5)
    20:36:18.064        at /opt/pages/build_tool/js/node_modules/wrangler/node_modules/esbuild/lib/main.js:2112:17
    20:36:18.064    
    20:36:18.064    
    20:36:18.064    ✘ [ERROR] [plugin wrangler-module-collector] ENOENT: no such file or directory, open '/opt/buildhome/repo/node_modules/@vercel/og/dist/yoga.wasm?module'
    20:36:18.065    
    20:36:18.065        ../node_modules/@vercel/og/dist/index.edge.js:10:22:
    20:36:18.065          10 │ import yoga_wasm from "./yoga.wasm?module";
    20:36:18.065             ╵                       ~~~~~~~~~~~~~~~~~~~~
    20:36:18.065    
    20:36:18.065      This error came from the "onResolve" callback registered here:
    20:36:18.065    
    20:36:18.065        ../../../pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:124157:19:
    20:36:18.066          124157 │             build5.onResolve(
    20:36:18.066                 ╵                    ~~~~~~~~~
    20:36:18.067    
    20:36:18.067    
    20:36:18.067    ✘ [ERROR] Build failed with 2 errors:
    20:36:18.067    
    20:36:18.067      ../node_modules/@vercel/og/dist/index.edge.js:9:23: ERROR: [plugin: wrangler-module-collector] ENOENT: no such file or directory, open '/opt/buildhome/repo/node_modules/@vercel/og/dist/resvg.wasm?module'
    20:36:18.068      ../node_modules/@vercel/og/dist/index.edge.js:10:22: ERROR: [plugin: wrangler-module-collector] ENOENT: no such file or directory, open '/opt/buildhome/repo/node_modules/@vercel/og/dist/yoga.wasm?module'
    In the docs I saw no mention of having to do anything else other than installing the plugin. Am I missing something by chance?
    c
    g
    n
    • 4
    • 5
  • wrangler pages dev when functions are not in root?
    i

    IanVS

    09/25/2023, 2:35 PM
    I keep my pages functions in a subfolder of my application, not at the top-level, but that causes problems when calling
    npx wrangler pages dev
    . I can't point it to that folder, or else the app does not start correctly (I get 404's), and I can't use
    npx wrangler pages dev -- <COMMAND>
    or else my functions are not found. Is there any way to support this structure?
    q
    • 2
    • 3
  • Why Pages don't have a wrangler.toml?
    p

    permaben

    10/10/2023, 6:10 AM
    I think the biggest confusion about using pages right now for me is that there is no real way of configuring a project in the CLI or with a wrangler.toml. This leads to all kinds of confusing things. For example, why do I need to specify a binding on
    wrangler pages dev
    ? It would be supercool if Pages would work more like workers. I create a folder, can do all the config I do in the UI for setting up there including all the config I normally have for workers and then deploy like that.
    v
    d
    k
    • 4
    • 6
  • MIME issue
    s

    sanjay_26383

    10/16/2023, 3:08 PM
    Hello everyone, I am facing issue after proxying a route checkoutv2 on cloudflare. The application is on next JS. A chunck JS file is returning HTML in response. here is the error : Refused to execute script from 'https://kapiva.in/_next/static/chunks/pages/checkoutv2-571404f0c18e2fed.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. Please help here.
    b
    t
    • 3
    • 4
  • Deployment Fails with @sveltejs/adapter-cloudflare
    k

    kdamp

    11/03/2023, 5:23 PM
    I am attempting to deploy to CloudFlare Page and I believe I need some help setting up my environment. My local environment is setup using Miniflare where I set the platform variable, here is what my
    hooks.server.ts
    file looks like:
    Copy code
    typescript
    export const handle: Handle = async ({ event, resolve }) => {
      if (dev) {
        const mf = await import('./lib/server/miniflare');
        event.platform = await mf.setupPlatform();
      }
    
      event.locals.db = getDB(event.platform!.env.DB);
      event.locals.auth = getAuth(event.platform!.env.DB).handleRequest(event);
    
      return await resolve(event);
    };
    I am using drizzle-orm and lucia-auth for this project. Here are some function definitions
    function getDB(db: D1Database) => DrizzleD1Database
    and
    function getAuth(db: D1Database) => AuthRequest
    (AuthRequest is a lucia type), however I don't think they are the issue, because it works just fine in my development environment with Miniflare. Here is what my
    app.d.ts
    file looks like:
    Copy code
    typescript
    /// <reference types="@sveltejs/adapter-cloudflare" />
    
    declare global {
      namespace App {
        interface Locals {
          auth: import("lucia").AuthRequest;
          db: import('drizzle-orm/d1').DrizzleD1Database<typeof import('$lib/schema')>;
        }
        interface Platform {
          env: {
            DB: D1Database;
            KV: KVNamespace;
            DOCS: R2Bucket;
          };
          context: {
            waitUntil(promise: Promise<any>): void;
          };
          caches: CacheStorage & { default: Cache };
          cf?: IncomingRequestCfProperties;
        }
      }
    
      namespace Lucia {
        type Auth = import("$lib/server/lucia").Auth;
        type DatabaseUserAttributes = {
           // ...
        };
        type DatabaseSessionAttributes = {};
      }
    }
    
    export {};
    When I build and attempt to deploy the build it says the
    event.platform
    is undefined:
    Copy code
    12:52:36.928    > Using @sveltejs/adapter-cloudflare
    12:52:38.216    TypeError: Cannot read properties of undefined (reading 'env')
    12:52:38.216        at Object.handle (file:///opt/buildhome/repo/.svelte-kit/output/server/chunks/hooks.server.js:34:42)
    ...
    Deployment ID -
    55b93723-6495-4000-bfb4-f3e971753c60
    I have search Google for an answer to my problem, but I haven't been able to find anyone else who is having the same problem with platform being undefined in a SvelteKit
    hooks.server.ts
    file. I have added the
    DB
    ,
    KV
    and
    DOCS
    bindings from the workers dashboard, however I don't think that is the problem as well, because the error shows that the
    event.platform
    variable is undefined. Hopefully I have enough information in this post. Any help is appreciated!
    k
    u
    • 3
    • 7
  • Custom domain with different paths for each repository
    n

    nykloon

    11/04/2023, 12:57 PM
    Hey there, I have a question regarding the hosting capabilities on Cloudflare Pages. Suppose I have two separate repositories,
    X
    and
    Y
    , and my intention is to host both under the same domain, such as
    your.domain.com
    . The structure I'm aiming for is to have repository
    X
    accessible at
    your.domain.com/previews/X
    and repository
    Y
    at
    your.domain.com/previews/Y
    . Does Cloudflare Pages support this type of configuration? Thanks in advance.
    c
    • 2
    • 4
  • Tailing Pages Functions
    m

    Muhymin

    11/09/2023, 1:41 PM
    Hi 👋 ! I am trying to tail deployments using both the dashboard and
    wrangler pages deployment tail
    commands but they aren't working. Starting any of them makes the entire website inaccessible. If someone visits the deployment, they see the
    Error 1101 Worker threw exception
    page. And the
    1101
    error page doesn't go away even after disabling the tails. Cloudflare doesn't output any useful error also, the error is simply
    Error: internal error
    . I need to tail the deployments to debug an issue but this bug isn't letting me use the tailing functionality.
    k
    e
    h
    • 4
    • 14
  • gitlab connect via cloudflare api
    e

    egemenozkan

    11/12/2023, 10:58 AM
    I have not found how to connect get repository via api. I'm looking for a scenario like following the screenshot.
    c
    • 2
    • 6
  • "An unknown error occured." when setting a .みんな domain as a custom page domain.
    h

    h4rl

    12/01/2023, 9:08 PM
    - h4rldev-github-io.pages.dev - 7246159d-50ce-48e0-ad0b-f74a5987c69b - 92762a528a515dfd74bdd5e974d386d0 - Errorcode 8000000
    k
    v
    e
    • 4
    • 27
  • segmentation fault when building Astro site
    r

    Rico.

    12/10/2023, 12:16 PM
    It always ends at this file:
    Copy code
    13:12:45.488    12:12:45   ▶ /_astro/tenhult_lake_1Bgy5U.webp (before: 303kB, after: 6kB) (+223ms) (107/263)
    13:12:45.858    Segmentation fault
    13:12:45.871    Failed: Error while executing user command. Exited with error code: 139
    13:12:45.881    Failed: build command exited with code: 1
    13:12:46.807    Failed: error occurred while running build command
    e
    h
    • 3
    • 8
  • Page not displaying?
    r

    ramandrem

    12/13/2023, 2:27 AM
    I uploaded a simple html and css. But when I click the deployment, it shows default demo page?
    c
    j
    d
    • 4
    • 84
  • Uploading HTML Based Project dynamically
    s

    ShowierData9978 (reply ping pls)

    12/14/2023, 5:38 AM
    python, httpx, build dir is ./build/html/
    c
    • 2
    • 6
  • NextJS is slower on CF than on Vercel
    m

    mrnooli

    12/14/2023, 4:02 PM
    So I'm looking to optimise my NextJS website (just the landing page) to ensure that it has the best ranking opportunities on Google. I ran the lighthouse test on the current website (https://cruncho.app) which is currently on CF and then compared it against (https://cruncho-landing-karthikjn01.vercel.app/) which is running on Vercel. I found the lighthouse score to be quite a bit better on vercel than on CF which is strange cos Vercel (edge) runs on CF right? Cloudflare LH score: (80) Vercel LH score: (94) If anyone would be able to help me out that'd be fantastic, thanks in advance!
    b
    b
    • 3
    • 8
  • Migrating from Vercel, vercel.json alternative
    d

    davidaae

    12/15/2023, 6:59 PM
    Hello everyone, I am migrating my projects from Vercel but cant find a way to setup my project like I used to in vercel using a vercel.json that contains: { "headers": [ { "source": "/assets/babylon/ext.babylon", "headers": [ { "key": "Accept-Encoding", "value": "br" }, { "key": "content-encoding", "value": "br" } ] } ], "cleanUrls": true } I have some “.babylon” files pre-compressed in brotli and just need the browser to use them. Any idea in how to achieve this?
    f
    c
    c
    • 4
    • 40
  • Cloudflare Pages and Subdomains for Users
    a

    alexander9602

    12/16/2023, 1:18 PM
    Hi. I have a use case that allows users to create their own spaces. Let's say I have UserA and UserB and they each deployed their space. I want to use Cloudflare pages to give them serverless pages UserA.example.com and UserB.example.com. Is there a way to automatically do it ? Currently I was thinking about creating a git branch per user and then adding a DNS record via Cloudflare API but maybe somebody knows another way? I also read about Cloudflare for SaaS but I am not sure it is suitable?
    c
    • 2
    • 3
  • Do Service bindings and Queues work in Nextjs pages?
    t

    turck

    12/17/2023, 12:46 AM
    I have a Nextjs pages project that uses bindings. R2 works for me, but Queues and Service bindings do not. Is this expected?
    k
    • 2
    • 5
  • Cache on client site won't be cleared
    b

    branchverse

    12/17/2023, 8:23 PM
    Some of my friends have on a github repo that I host via pages still the old site, which is now more than 8 months old. I have the TTL on 5 Minutes now, I pressed clear all cache data, also turned on and off Developer mode for a while, but they do not get the new page. Deleting cookies on their end does also not give them the new site. I don't know what else to do or what they can try, the biggest issue: I can't recreate it, since I get the newest version all the time... even if I make a single letter change now in the repo. Any idea? well the preview obviously the working one: fc697884.nettsoviel.pages.dev
    h
    • 2
    • 17
  • Building with Python
    l

    lunarings

    12/18/2023, 6:55 AM
    so im new to cloudflare pages and stuff but basically I need help because my website runs off of python, so basically it would need to like install requirements.txt first then run
    python manage.py runserver
    , but the thing is i have 0 clue on how to execute this and i need help with it.
    h
    c
    h
    • 4
    • 6
  • Why does `npm create cloudflare svelte-app -- --framework=svelte` take forever on my system?
    m

    Merwllyra

    12/18/2023, 7:29 PM
    First, it's downloading the package or something, then it's checking for updates, even though it JUST downloaded a fresh copy, and then each step seems to take forever. "╭ Create an application with Cloudflare Step 1 of 3" — Sometimes doesn't take input! It's just like "╰ Continue with Svelte via `npx create-svelte@5.3.3 svelte-app`" — but I press enter, y anything, it just won't work And then "╭ Configuring your application for Cloudflare Step 2 of 3" just crashed on me! And there's no way to
    --continue
    or anything. Running the command again takes forever, and then there are other issues, and ... I really hoped I can kick off a quick SvelteKit project on Cloudflare, man! I really believed it would be super easy. Come on!
    • 1
    • 1
  • Different requests get different files
    b

    Ben-xD

    12/18/2023, 9:31 PM
    Different client requesting the same file (sw.js) are getting different files. This is bad for PWAs, but browsers think there is a new version whenever the user opens the page Does anyone know why that might happen? I have more detail in a post: https://discord.com/channels/595317990191398933/789155108529111069/1185984798804672662
    • 1
    • 1
  • How to do client-side rewrites on statically exported Next.js site?
    d

    deanmauro

    12/18/2023, 10:13 PM
    I have a statically exported Next.js site, meaning a single-page app built with
    next export
    and uploaded to CF pages. I've added a \_redirects file with
    /:org/service_/* /:splat 200
    to mimic Next.js rewrites (e.g. user goes to
    /123/service_/contact-us
    and lands on the
    /contact-us
    page. The rewriting is successfully happening. I get to the right page and see the right URL in the address bar. BUT all navigation causes a full re-render of the page, common elements included. Is there a way to do Next.js-style rewrites without causing full-page re-renders on every route change?
1...56789Latest