Skip to content

[Cloudflare Adapter] auto generated _routes.json can easily exclude Functions invocation routes limits #3039

@twodft

Description

@twodft

By default, @astrojs/cloudflare will generate a _routes.json file that lists all files from your dist/ folder and redirects from the _redirects file in the exclude array. This will enable Cloudflare to serve files and process static redirects without a function invocation. Creating a custom _routes.json will override this automatic optimization and, if not configured manually, cause function invocations that will count against the request limits of your Cloudflare plan.

We should add a note to Cloudflare adapter document since the default auto-generated _route.json file can easily exclude the limits and cause Cloudflare Pages deployment failed.

A example error log

Error: Failed to publish your Function. Got error: Error 8000057: Rules in `_routes.json` are over the 100 rule limit. Refer to https://cfl.re/3FsE4aF.

The limits on Cloudflare Pages Functions doc

Functions invocation routes have the following limits:

You must have at least one include rule.
You may have no more than 100 include/exclude rules combined.
Each rule may have no more than 100 characters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    add new contentDocument something that is not in docs. May require testing, confirmation, or affect other pages.good first issueGood for newcomershelp wantedIssues looking for someone to run with them!

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions