Skip to content

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

@MastalerzKamil

Description

@MastalerzKamil

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions