turbo lint env not typed

Hey people, i got an type error on local turbo run build --filter api and on vercel deployment of that app (using monorepo with 4 apps ). turbo run lint --filter api is working fine. Here the error i get:
api:build: ../admin/src/server/api_calls/error_handler.ts:7:17
api:build: Type error: Property 'NEXT_PUBLIC_DEBUG' does not exist on type '{}'.
api:build:
api:build: 5 | export function axiosErrorHandler(error: unknown): ApiCallerError {
api:build: 6 | if (axios.isAxiosError(error)) {
api:build: > 7 | if (env.NEXT_PUBLIC_DEBUG === "true") console.log("error", error);
api:build: | ^
api:build: 8 | // Request was made but server didn´t responded.
api:build: 9 | if (!error.response) return { success: false, error: null };
api:build: 10 | else {
api:build:  ELIFECYCLE  Command failed with exit code 1.
api:build: ERROR: command finished with error: command (/Users/balduin/Nessy GmbH/repos/nessy-systems/apps/api) pnpm run build exited (1)
command (/Users/balduin/Nessy GmbH/repos/nessy-systems/apps/api) pnpm run build exited (1)
api:build: ../admin/src/server/api_calls/error_handler.ts:7:17
api:build: Type error: Property 'NEXT_PUBLIC_DEBUG' does not exist on type '{}'.
api:build:
api:build: 5 | export function axiosErrorHandler(error: unknown): ApiCallerError {
api:build: 6 | if (axios.isAxiosError(error)) {
api:build: > 7 | if (env.NEXT_PUBLIC_DEBUG === "true") console.log("error", error);
api:build: | ^
api:build: 8 | // Request was made but server didn´t responded.
api:build: 9 | if (!error.response) return { success: false, error: null };
api:build: 10 | else {
api:build:  ELIFECYCLE  Command failed with exit code 1.
api:build: ERROR: command finished with error: command (/Users/balduin/Nessy GmbH/repos/nessy-systems/apps/api) pnpm run build exited (1)
command (/Users/balduin/Nessy GmbH/repos/nessy-systems/apps/api) pnpm run build exited (1)
the env variable is getting importet from env/client.mjs (the normal t3-stack env validation). in my IDE i get the correct type on hovering env doe. I am guessing the Problem is that I'm importing from an .mjs module. Can anyone help me with this one?
1 Reply
Balduin
Balduin12mo ago
when i have a file open in the api app i also get the error in my IDE problems window, but when i click it to switch to the file the error goes away... but not in all files where i use the env object from the same import....