Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Invalid config. Please export the config as the variable const #4

Open
k-zakhariy opened this issue Mar 8, 2023 · 2 comments

Comments

@k-zakhariy
Copy link

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",
@cstrnt
Copy link
Owner

cstrnt commented Mar 10, 2023

Hey, can you please show me the code of the api route or a code example

@hydrohiester
Copy link

hydrohiester commented Dec 19, 2023

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,
  },
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants