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

Github Action production build fail at 'Creating an optimized production build' stage -> TypeError: processor is not a function #35267

Closed
1 task done
beumsk opened this issue Mar 11, 2022 · 13 comments
Labels
bug Issue was opened via the bug report template.

Comments

@beumsk
Copy link

beumsk commented Mar 11, 2022

Verify canary release

  • I verified that the issue exists in Next.js canary release

Provide environment information

Github Actions env
Environment: ubuntu-20.04
Version: 20220227.1

What browser are you using? (if relevant)

N/A

How are you deploying your application? (if relevant)

Github actions

Describe the Bug

With Next.js v11.1.3

Github Action production build fail at 'Creating an optimized production build' stage.
TypeError: processor is not a function

While this error happens in Github actions, there is not a single error in my local env when I run the next build command.

Here is the full log of Github action error:
https://github.com/beumsk/beumsk.github.io/runs/5513878505?check_suite_focus=true

`> rb@1.1.0 build /home/runner/work/beumsk.github.io/beumsk.github.io

next build

info - Using webpack 4. Reason: webpack5 flag is set to false in next.config.js https://nextjs.org/docs/messages/webpack5
info - Checking validity of types...
info - Creating an optimized production build...
Failed to compile.

TypeError: processor is not a function

Build error occurred
Error: > Build failed because of webpack errors
at nextBuildSpan.traceAsyncFn (/home/runner/work/beumsk.github.io/beumsk.github.io/node_modules/next/dist/build/index.js:397:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rb@1.1.0 build: next build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rb@1.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-03-11T16_29_05_627Z-debug.log
Error: Process completed with exit code 1.`

Expected Behavior

The production build should work as it does in my local env.

To Reproduce

It must have something to with Ubuntu I guess since that's what Github action uses and I'm not.
However I really don't see what could cause it and the error isn't helpful to me.
I don't know how you can reproduce the issue since it happens with ubuntu.

@beumsk beumsk added the bug Issue was opened via the bug report template. label Mar 11, 2022
@frankchau93
Copy link

Im getting this issue too! been scrambling around trying to figure this out but nothing is working!

@wasd171
Copy link

wasd171 commented Mar 11, 2022

It's same for me (macOS). I think one of nextjs' dependencies has updated and now there is a version mismatch somewhere (https://github.com/Timer/cssnano-simple/releases/tag/v3.0.1 ?)

TypeError: processor is not a function
    at /Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/cssnano-simple@3.0.0_postcss@8.2.15/node_modules/cssnano-simple/src/index.js:46:22
    at Array.forEach (<anonymous>)
    at Object.module.exports [as default] (/Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/cssnano-simple@3.0.0_postcss@8.2.15/node_modules/cssnano-simple/src/index.js:28:39)
    at CssMinimizerPlugin.optimizeAsset (/Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/next@12.0.0_4cc4bb2cb5144220f8620e3e1ad8db1d/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:41:40)
    at /Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/next@12.0.0_4cc4bb2cb5144220f8620e3e1ad8db1d/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:77:55
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Span.traceAsyncFn (/Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/next@12.0.0_4cc4bb2cb5144220f8620e3e1ad8db1d/node_modules/next/dist/trace/trace.js:74:20)
    at async Promise.all (index 0)
    at async /Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/next@12.0.0_4cc4bb2cb5144220f8620e3e1ad8db1d/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:64:21
    at async Span.traceAsyncFn (/Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/next@12.0.0_4cc4bb2cb5144220f8620e3e1ad8db1d/node_modules/next/dist/trace/trace.js:74:20)
caused by plugins in Compilation.hooks.processAssets
TypeError: processor is not a function
    at /Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/cssnano-simple@3.0.0_postcss@8.2.15/node_modules/cssnano-simple/src/index.js:46:22
    at Array.forEach (<anonymous>)
    at Object.module.exports [as default] (/Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/cssnano-simple@3.0.0_postcss@8.2.15/node_modules/cssnano-simple/src/index.js:28:39)
    at CssMinimizerPlugin.optimizeAsset (/Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/next@12.0.0_4cc4bb2cb5144220f8620e3e1ad8db1d/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:41:40)
    at /Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/next@12.0.0_4cc4bb2cb5144220f8620e3e1ad8db1d/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:77:55
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Span.traceAsyncFn (/Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/next@12.0.0_4cc4bb2cb5144220f8620e3e1ad8db1d/node_modules/next/dist/trace/trace.js:74:20)
    at async Promise.all (index 0)
    at async /Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/next@12.0.0_4cc4bb2cb5144220f8620e3e1ad8db1d/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:64:21
    at async Span.traceAsyncFn (/Users/wasd171/Coding/rebels-app/common/temp/node_modules/.pnpm/next@12.0.0_4cc4bb2cb5144220f8620e3e1ad8db1d/node_modules/next/dist/trace/trace.js:74:20)

@wasd171
Copy link

wasd171 commented Mar 11, 2022

So I think the issue is that cssnano-simple@3.0.0 depends on cssnano-preset-simple@^3.0.0. So the package manager resolves next@12.0.0 -> cssnano-simple@3.0.0 -> cssnano-preset-simple@3.0.1.
I've pinned my cssnano-preset-simple to 3.0.0 and build works again.

Seems like it should be fixed in master already #35258

@frankchau93
Copy link

@wasd171 What do you mean by 'pinned'? How can i fix this

@dionevoss
Copy link

Im having the same issue with next@11.
Changing cssnano-simple version, didn't work for me.

3.112 info - Using external babel configuration from /srv/app/.babelrc
68.04 Failed to compile.
68.04
68.04 HookWebpackError: processor is not a function
68.04
68.04
68.04 > Build error occurred
68.04 Error: > Build failed because of webpack errors
68.04 at /srv/app/node_modules/next/dist/build/index.js:397:19
68.04 at async Span.traceAsyncFn (/srv/app/node_modules/next/dist/telemetry/trace/trace.js:60:20)
68.04 at async Object.build [as default] (/srv/app/node_modules/next/dist/build/index.js:77:25)

@edenriquez
Copy link

edenriquez commented Mar 11, 2022

Add resolutions key to your package.json and put cssnano-preset-simple inside that should fix the problem

"resolutions": {
    "cssnano-preset-simple": "3.0.0"
  },

@dionevoss
Copy link

Add resolutions key to your package.json and put cssnano-preset-simple inside that should fix the problem

"resolutions": {
    "cssnano-preset-simple": "3.0.0"
  },

This worked, thanks!! 🚀

@frankchau93
Copy link

Thank you, this worked!

@RamyaChinnadurai
Copy link

RamyaChinnadurai commented Mar 12, 2022

Add resolutions key to your package.json and put cssnano-preset-simple inside that should fix the problem

"resolutions": {
    "cssnano-preset-simple": "3.0.0"
  },

This solution, working fine. Thanks.

@beumsk
Copy link
Author

beumsk commented Mar 12, 2022

Somehow it didn't work at first but after relaunching the action a couple of times, it did.
Many thanks! 🚀
Any idea if we will be able to remove this resolution somewhere in the future?

clnhs added a commit to clnhs/react-jisho that referenced this issue Mar 12, 2022
clnhs added a commit to clnhs/react-jisho that referenced this issue Mar 12, 2022
@fanshaohua-fan
Copy link

Have the same issue while packaging the image with docker FROM node:14-alpine.

# Install dependencies only when needed
FROM node:14-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY src/package.json ./
RUN yarn install --frozen-lockfile

# Rebuild the source code only when needed
FROM node:14-alpine AS builder

WORKDIR /app
COPY ./src .
COPY --from=deps /app/node_modules ./node_modules
RUN yarn build

Error detail:

info  - Creating an optimized production build...
warn  - using beta Middleware (not covered by semver) - https://nextjs.org/docs/messages/beta-middleware
Failed to compile.

HookWebpackError: processor is not a function
    at makeWebpackError (/app/node_modules/next/dist/compiled/webpack/bundle5.js:47121:9)
    at /app/node_modules/next/dist/compiled/webpack/bundle5.js:31041:12
    at eval (eval at create (/app/node_modules/next/dist/compiled/webpack/bundle5.js:141201:10), <anonymous>:34:1)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
-- inner error --
TypeError: processor is not a function
    at /app/node_modules/cssnano-simple/src/index.js:46:22
    at Array.forEach (<anonymous>)
    at Object.module.exports [as default] (/app/node_modules/cssnano-simple/src/index.js:28:39)
    at CssMinimizerPlugin.optimizeAsset (/app/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:41:40)
    at /app/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:77:55
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Span.traceAsyncFn (/app/node_modules/next/dist/trace/trace.js:74:20)
    at async Promise.all (index 0)
    at async /app/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:64:21
caused by plugins in Compilation.hooks.processAssets
TypeError: processor is not a function
    at /app/node_modules/cssnano-simple/src/index.js:46:22
    at Array.forEach (<anonymous>)
    at Object.module.exports [as default] (/app/node_modules/cssnano-simple/src/index.js:28:39)
    at CssMinimizerPlugin.optimizeAsset (/app/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:41:40)
    at /app/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:77:55
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Span.traceAsyncFn (/app/node_modules/next/dist/trace/trace.js:74:20)
    at async Promise.all (index 0)
    at async /app/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:64:21


> Build failed because of webpack errors
error Command failed with exit code 1.

@jankaifer
Copy link
Contributor

jankaifer commented Jan 12, 2023

The original issue was probably caused by cssnano-preset-simple version mismatch. That was a long time ago, so it's probably not relevant anymore.

@fanshaohua-fan your issue seems to be unrelated, could you open a new issue with ac complete reproduction?

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

8 participants