Skip to content

[next.js] Doesn't work on Cloudflare Pages #23

@chrisbaume

Description

@chrisbaume

Steps:

  1. Set up next.js template on Cloudflare Pages using this guide
  2. npm install @logtail/next
  3. In next.config.mjs, add export default withLogtail(nextConfig)
  4. In middleware.ts add export default withLogtail(middleware)
  5. Create the following page.tsx
import { log } from "@logtail/next";
export const runtime = "edge";
export default async function Page() {
  log.info('Next.js page log test')
  return <p>Done</p>
}
  1. Create a .env.local with LOGTAIL_SOURCE_TOKEN and LOGTAIL_URL, then test locally using npm run dev.
  2. Deploy to Cloudflare with env vars LOGTAIL_SOURCE_TOKEN and LOGTAIL_URL and test.

Results

When running locally, the logs appear as expected. When running on Cloudfare Pages, no logs appear.

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