Skip to content

Document issue for honox + auth0-hono on Cloudflare Pages #16

@butameron

Description

@butameron

I tried to use auth0-hono in a honox project deployed on Cloudflare Pages, following the official documentation, but it did not work as expected.

After investigating, I found the following points are required for it to work properly, but they are not clearly documented:

Key points

  • Environment variables must be accessed via c.env, not process.env, when running on Cloudflare Pages.
  • The auth middleware needs to be added to _middleware.ts, not server.ts.

Example

// _middleware.ts

export const myAuth = (c: Context<OIDCEnv>, next: Next) => {
  const a = auth({
    domain: c.env.AUTH0_DOMAIN || '',
    // etc.
  });
  return a(c, next);
};

export default createRoute(myAuth);

It would be helpful if the documentation mentioned these requirements explicitly, especially for users deploying honox on Cloudflare Pages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions