next-multiparty
next-multiparty copied to clipboard
Error: Invalid config. Please export the config as the variable `const`
I wrapped API handler as in example with exporting const , but facing following issue:
Error: Invalid config. Please export the config as the variable `const`
at _callee$ (/Users/user/Development/www/project/node_modules/next-multiparty/dist/next-multiparty.cjs.development.js:936:21)
at tryCatch (/Users/user/Development/www/project/node_modules/next-multiparty/dist/next-multiparty.cjs.development.js:130:40)
at Generator.invoke [as _invoke] (/Users/user/Development/www/project/node_modules/next-multiparty/dist/next-multiparty.cjs.development.js:361:22)
at Generator.next (/Users/user/Development/www/project/node_modules/next-multiparty/dist/next-multiparty.cjs.development.js:186:21)
at asyncGeneratorStep (/Users/user/Development/www/project/node_modules/next-multiparty/dist/next-multiparty.cjs.development.js:12:24)
at _next (/Users/user/Development/www/project/node_modules/next-multiparty/dist/next-multiparty.cjs.development.js:34:9)
at /Users/user/Development/www/project/node_modules/next-multiparty/dist/next-multiparty.cjs.development.js:41:7
at new Promise (<anonymous>)
at /Users/user/Development/www/project/node_modules/next-multiparty/dist/next-multiparty.cjs.development.js:30:12
at /Users/user/Development/www/project/node_modules/next-multiparty/dist/next-multiparty.cjs.development.js:995:19
"next": "12.3.4",
"next-multiparty": "^0.6.3",
Hey, can you please show me the code of the api route or a code example
I got a similar warning,
Next.js can't recognize the exported `config` field in route "/api/files/upload/[fileId]": Unsupported node type "CallExpression" at "config". The default config will be used instead.
I believe it is because dynamic evaluations are not allowed? (https://nextjs.org/docs/messages/invalid-page-config)
Since I know I'm using it in an api route, I just made it static, like:
export const config = {
api: {
bodyParser: false,
},
};