Next.js Discord

Discord Forum

Noblox with Next.js | Cannot find module asn1.js

Unanswered
European hornet posted this in #help-forum
Open in Discord
European hornetOP
I am trying to implement noblox library into my Next.js app. Here is my API route where I use the library:

const noblox = require("noblox.js");

import { verifyJwt } from "@/lib/jwt";

interface RequestBody {
  cookie: string;
}

export async function POST(request: Request) {
  const accessToken = request.headers.get("authorization");

  if (!accessToken || !verifyJwt(accessToken))
    return new Response(
      JSON.stringify({
        error: "Unauthorized",
      }),
      {
        status: 401,
      }
    );

  const body: RequestBody = await request.json();

  const robloxAccount = await noblox.setCookie(body.cookie);

  console.log(
    `Logged in as ${robloxAccount.UserName} [${robloxAccount.UserID}]`
  );

  return new Response(
    JSON.stringify({
      success: `Logged in as ${robloxAccount.UserName} [${robloxAccount.UserID}]`,
    }),
    {
      status: 200,
    }
  );
}


And this is the error I get:

Cannot find module 'F:\\...\\.next\\server\\vendor-chunks/asn1.js

0 Replies