Next.js Discord

Discord Forum

Build error NextJS 14.1 parseEnvironment() error

Answered
Kapatid posted this in #help-forum
Open in Discord
Avatar
My SST + NextJS apps keeps getting this error:
../app/[locale]/(app-pages)/genai/gallery/page.js from Terser
  x await isn't allowed in non-async function
       ,-[46332:1]
 46332 | //     }
 46333 | //   }
 46334 | // }
 46335 | const allVariables = await parseEnvironment();
       :                            ^^^^^^^^^^^^^^^^
 46336 | function createProxy(constructName) {
 46337 |     const result = new Proxy({}, {
 46338 |         get (target, prop) {
       `----

Caused by:
    0: failed to parse input file
    1: Syntax Error
Error:
  x await isn't allowed in non-async function
       ,-[46332:1]
 46332 | //     }
 46333 | //   }
 46334 | // }
 46335 | const allVariables = await parseEnvironment();
       :                            ^^^^^^^^^^^^^^^^
 46336 | function createProxy(constructName) {
 46337 |     const result = new Proxy({}, {
 46338 |         get (target, prop) {
       `----

Caused by:
    0: failed to parse input file
    1: Syntax Error


> Build failed because of webpack errors

The thing is I don't even have this codes in my page.tsx and I don't have any async functions in it or nextjs actions.

Attached in this post is my dependencies. I have also tried only running npx next build without sst bind but it gives the same error. Also, npm run dev works fine. Does anyone know the problem?
Image
Answered by Kapatid
View full answer

1 Reply

Avatar
Answer