Build Error on Vercel, no error when building on my local environment
Unanswered
American Crocodile posted this in #help-forum
American CrocodileOP
Hi !
I'm currently building a PWA application (@ducanh2912/next-pwa)
When I build locally I don't have error. (PWA is disabled locally) but when I push, I have an error on Vercel:
It seems that Vercel try to access my route during the build phase ?
Here is my api route code:
Any ideas ? many thanks !
I'm currently building a PWA application (@ducanh2912/next-pwa)
When I build locally I don't have error. (PWA is disabled locally) but when I push, I have an error on Vercel:
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
at new NodeError (node:internal/errors:405:5)
at Function.from (node:buffer:333:9)
at 87814 (/vercel/path0/.next/server/app/api/pubsub/subscription/route.js:1:2097)
at t (/vercel/path0/.next/server/webpack-runtime.js:1:128)
at 38060 (/vercel/path0/.next/server/app/api/pubsub/subscription/route.js:1:1280)
at t (/vercel/path0/.next/server/webpack-runtime.js:1:128)
at t (/vercel/path0/.next/server/app/api/pubsub/subscription/route.js:1:2899)
at /vercel/path0/.next/server/app/api/pubsub/subscription/route.js:1:2930
at t.X (/vercel/path0/.next/server/webpack-runtime.js:1:1196)
at /vercel/path0/.next/server/app/api/pubsub/subscription/route.js:1:2912 {
code: 'ERR_INVALID_ARG_TYPE'
> Build error occurred
Error: Failed to collect page data for /api/pubsub/subscription
at /vercel/path0/node_modules/next/dist/build/utils.js:1217:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'Error'It seems that Vercel try to access my route during the build phase ?
Here is my api route code:
import { NextResponse, NextRequest } from "next/server";
import PubSub from "@/lib/pubsub";
export async function POST(req: NextRequest, res: NextResponse) {
const body = await req.json();
const { topic, subscription } = body;
if (!topic || !subscription) {
return Response.error();
}
await PubSub.createSubscription(topic, subscription);
return Response.json({ success: false, message: "Subscription created" });
}Any ideas ? many thanks !