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

[Bug] Error while using middleware from Next 12.2 #367

Open
MastalerzKamil opened this issue Oct 9, 2022 · 1 comment
Open

[Bug] Error while using middleware from Next 12.2 #367

MastalerzKamil opened this issue Oct 9, 2022 · 1 comment

Comments

@MastalerzKamil
Copy link

MastalerzKamil commented Oct 9, 2022

Does the tf-next 1.0.0 canary5 supports middleware from Next 12.2? It has been changed because from developer perspective, now we are using file middleware.ts at the root of the app instead _middleware.ts in pages.

After my investigation I noticed that tf-next 1.0.0 canary 5 has a trouble it while using command tf-next build. The error that appears is the following.

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
info  - Linting and checking validity of types  
info  - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
info  - Using external babel configuration from /private/var/folders/ky/64jxxk4n7k1bmhzcbz0zn2740000gn/T/tmp-15280-zg5kTWAsNr1g/.babelrc
info  - Creating an optimized production build  
info  - Compiled successfully
info  - Collecting page data  
info  - Generating static pages (13/13)
info  - Finalizing page optimization  


> Build error occurred
[Error: ENOENT: no such file or directory, open '/private/var/folders/ky/64jxxk4n7k1bmhzcbz0zn2740000gn/T/tmp-11918-8LTrk8VsTpg2/.next/server/edge-runtime-webpack.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/private/var/folders/ky/64jxxk4n7k1bmhzcbz0zn2740000gn/T/tmp-11918-8LTrk8VsTpg2/.next/server/edge-runtime-webpack.js'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Build failed:
NowBuildError: Command "yarn run build" exited with 1
    at ChildProcess.<anonymous> (/Users/kamilmastalerz/.nvm/versions/node/v16.15.1/lib/node_modules/tf-next/node_modules/@vercel/build-utils/dist/index.js:33545:20)
    at ChildProcess.emit (node:events:527:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  hideStackTrace: true,
  code: 'BUILD_UTILS_SPAWN_1',
  link: undefined,
  action: undefined
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I have used before yarn build and everything is fine. Does anyone has a tips how to workaround it. Please fix it because it seems to be an issue on library site

@MastalerzKamil MastalerzKamil changed the title Error while using middleware from Next 12.2 [Bug] Error while using middleware from Next 12.2 Oct 9, 2022
@datagutt
Copy link

datagutt commented Oct 10, 2022

Middleware is not supported with Lambda and Lambda@Edge, as mentioned both in the top of README and in this issue: #273 (comment)
I would love for middleware support myself, but this seems to be a limitation with AWS, according to both the author of this projects and other projects (serverless-nextjs).

This, coupled with lack of support for redirects in getServerSideProps, means i am currently unable to use this project for any real-world usage.

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

2 participants