Stytch plugin

This is in my report/_middleware.js file:

import stytchPlugin from "@cloudflare/pages-plugin-stytch";
import { envs } from "@cloudflare/pages-plugin-stytch/api";

export const onRequest = stytchPlugin({
  project_id: "xxx",
  secret: "xxx",
  env: envs.test,

Then in report/[id].js:

export async function onRequestGet(context) {
  return new Response("OK");

When I hit my endpoint/report/abcd, I’m getting an error:

"exceptions": [
      "name": "TypeError",
      "message": "argument str must be a string",
      "timestamp": 1680819155110

I can’t think why it would be throwing that. I added "type": "module", in package.json as I’m doing an import in _middleware.js. I tried the ts version but I’m not up on ts and it was throwing an error too. @cloudflare/pages-plugin-stytch is in package.json and builds fine. Here are the docs but they I can’t find anything more than this. Stytch · Cloudflare Pages docs

Any ideas why this could happen?