@discordjs/rest with Nextjs

I'm using @discordjs/rest in my Nextjs app inside app api folder, it works on dev perfectly fine, but when I try to build the app I just get:
> next build

Failed to compile.

805.js from Terser
Unexpected token: punc ({) [805.js:30255,10]
at js_error (*:\*\*\node_modules\next\dist\compiled\terser\bundle.min.js:1:32780)
at croak (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:43882)
at token_error (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:43989)
at unexpected (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:44055)
at as_property_name (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:68487)
at concise_method_or_getset (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:64746)
at class_ (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:64098)
at expr_atom (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:61955)
at maybe_unary (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:71619)
at expr_ops (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:72615)


> Build failed because of webpack errors
Creating an optimized production build . ELIFECYCLE  Command failed with exit code 1.

Process finished with exit code 1
> next build

Failed to compile.

805.js from Terser
Unexpected token: punc ({) [805.js:30255,10]
at js_error (*:\*\*\node_modules\next\dist\compiled\terser\bundle.min.js:1:32780)
at croak (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:43882)
at token_error (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:43989)
at unexpected (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:44055)
at as_property_name (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:68487)
at concise_method_or_getset (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:64746)
at class_ (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:64098)
at expr_atom (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:61955)
at maybe_unary (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:71619)
at expr_ops (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:72615)


> Build failed because of webpack errors
Creating an optimized production build . ELIFECYCLE  Command failed with exit code 1.

Process finished with exit code 1
5 Replies
d.js toolkit
d.js toolkit14mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
treble/luna
treble/luna14mo ago
this does not look like a djs issue
React
ReactOP14mo ago
hmmm is there any other way I can achieve reading thread messages without @discordjs/rest
treble/luna
treble/luna14mo ago
probably, but that would be outside the scope of djs
React
ReactOP14mo ago
hmm
Want results from more Discord servers?
Add your server