#Does anybody deploy dynamic+static application to Cloudflare Pages successfully?

1 messages · Page 1 of 1 (latest)

austere sentinel
#

My configuration as follows:

{
    // ...
    output: 'server',
    build: {
        format: 'directory',
    },
    adapter: cloudflare({
        platformProxy: {
            enabled: true,
        },
    }),
    // ...
}

The dynamic pages wasn't found in production after deploying the built site, it only works for the prerender pages.

And I removed the _worker.js folder from dist, and create a simple _worker.js file, then re-deploy the site, and all pages works (including static pages and dynamic pages, the dynamic pages simply response the Ok).

export default {
  async fetch(request, env) {
    return new Response('Ok')
  },
}

Any ideas? Thanks.

#

It seems that the _worker.js folder wasn't treated as worker on Cloudflare Pages.
I got an error when trying to debug the imcomming requests: The requested Worker version could not be found, please check the ID being passed and try again.
There is no error and catch requests successfully with the simple _worker.js file.
Is there an option to bundle the application as file rather than folder?

Advanced mode allows you to develop your Pages Functions with a _worker.js file rather than the /functions directory.

https://developers.cloudflare.com/pages/functions/advanced-mode/

Cloudflare Docs
austere sentinel
#

Does anybody deploy dynamic+static application to Cloudflare Pages successfully?