How to make build skip certain routes?
Unanswered
American posted this in #help-forum
AmericanOP
During build in my CI pipeline, NextJS tries to build a path and fails:
This is a
Error: Failed to collect page data for /labs/spellcheck/api
This is a
route.ts
file which needs some env var that isn't available during build time. How can I tell NextJS to skip it? I tried using export const dynamic = "force-dynamic";
but no change1 Reply
AmericanOP
Had to rework the logic a bit, instead of doing import {openai} I did import {getOpenAI} and later const openai = await getOpenAI()