Skip to content

[Bug]: cache refusal on an extension-protected route says "conditional routing requires cache disabled or no-store" #725

Closed

Description

@jimhoyd

Runtime revision and environment

main @ 8260423. Found while implementing #703 (auth credential RateLimit on allowed responses), by reading packages/core/src/router.ts and hitting it in a test.

Minimal reproduction

routes:
  /api/items:
    function: functions/items.mjs
    auth: {bearer: {scopes: [items.read]}}
    policies:
      cache: {strategy: public, maxAge: 60}

(with extensions.auth declared). The route is refused at startup, which is correct: protected responses must not be cached. But the message is:

/api/items: conditional routing requires cache disabled or no-store

The route has no match/conditional. The same assertion (router.ts ~106, and the response-header one after it) covers match, conditional, extension handlers and sensitive extension policies, and its message names only the first case.

Relevant output

Suggested: choose the message by the condition that fired, e.g. /api/items: routes protected by extension "auth" cannot be cached; use cache: {strategy: no-store} or remove cache, and likewise for extension handlers. Keep the conditional wording for match/conditional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions