thomvaill/log4brains

log4brains@1.0.0-beta.8 preview and build not working even with the base setup

rahul-gottupulla opened this issue · 11 comments

Bug Report

Description

The "next" package is being referred internally and it installed the latest automatically. Earlier this week, when I installed log4brains@1.0.0-beta.8 "next 10.0.7" was being used and everything is working as expected, Now it's referring to the "next 10.0.8" and things started to break.

Steps to Reproduce

  1. Installed the latest version of the log4brains.
  2. Ran "log4brains init" to create the .log4brains.yml and docs folder.
  3. "log4brains preview" is failing with the below error.
    image
  4. "log4brains build" is executing till the end but the outputs are not being generated.

Environment

  • Log4brains version: 1.0.0-beta.8
  • Node.js version: v15.10.0
  • OS and its version: Windows 10
  • Browser information: NA

Possible Solution

Fix the reference to the NEXTJS.

Same here:

❯ DEBUG=1 npx log4brains preview                                                                                                                                                                                                                                  
Run `next start`...
[==  ] Log4brains is starting... Error


 FATAL  Cannot read property 'incrementalOptions' of undefined

TypeError: Cannot read property 'incrementalOptions' of undefined
    at previewCommand (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/@log4brains/web/dist/cli/commands/preview.js:27:26)
    at Command.program.command.description.option.option.action (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/@log4brains/web/dist/cli/cli.js:13:16)
    at Command.listener [as _actionHandler] (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/commander/index.js:426:31)
    at Command._parseCommand (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/commander/index.js:1002:14)
    at Command._dispatchSubcommand (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/commander/index.js:953:18)
    at Command._parseCommand (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/commander/index.js:970:12)
    at Command.parse (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/commander/index.js:801:10)
    at Command.parseAsync (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/commander/index.js:828:10)
    at Object.<anonymous> (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/dist/main.js:26:9)
    at Generator.next (<anonymous>)
    at bl (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/esm/esm.js:1:245412)
    at kl (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/esm/esm.js:1:247659)
    at Object.u (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/esm/esm.js:1:287740)
    at Object.o (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/esm/esm.js:1:287137)
    at Object.<anonymous> (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/esm/esm.js:1:284879)
    at Object.apply (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/esm/esm.js:1:199341)
[Next] 
info  - Collecting page data  
[Next]  info  - Generating static pages (5/5)
info  - Finalizing page optimization  
[Next] 
[Next]  Page                                                             Size     First Load JS
┌ ● / (ISR: 1 Seconds)                                           229 B           475 kB
├   /_app                                                        0 B            47.3 kB
├ ○ /404                                                         1.21 kB        48.5 kB
├ ● /adr/[...slug]                                               238 B           475 kB
├   ├ /adr/20210306-use-log4brains-to-manage-the-adrs
├   └ /adr/20210306-use-markdown-architectural-decision-records
├ λ /api/adr                                                     0 B            47.3 kB
├ λ /api/adr/[...slugAndMore]                                    0 B            47.3 kB
└ λ /api/search-index                                            0 B            47.3 kB
+ First Load JS shared by all                                    47.3 kB
  ├ chunks/a3e17150ead73d62fba7a33a50672ae3f72841a5.bea17f.js    20.3 kB
  ├ chunks/commons.4040d7.js                                     17.3 kB
  ├ chunks/main.f303bd.js                                        6.34 kB
  ├ chunks/pages/_app.f3033c.js                                  2.67 kB
  ├ chunks/webpack.50bee0.js                                     751 B
  └ css/d50ac9751859b3eb4bb6.css                                 390 B
[Next] 
[Next]  λ  (Lambda)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
○  (Static)  automatically rendered as static HTML (uses no initial props)
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
   (ISR)     incremental static regeneration (uses revalidate in getStaticProps)
[Next] 
Run `next export`...
[Next]  
[Next]   FATAL  The "path" argument must be of type string. Received type undefined
[Next]  
[Next]  TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at join (path.js:1147:7)
    at /Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/next/dist/export/index.js:3:363
    at tracer.withSpan (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/next/dist/build/tracer.js:3:476)
    at NoopTracer.withSpan (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js:47:16)
    at ProxyTracer.withSpan (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js:36:34)
    at traceAsyncFn (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/next/dist/build/tracer.js:3:435)
    at exportApp (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/next/dist/export/index.js:2:475)
    at execNext (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/@log4brains/web/dist/cli/commands/build.js:45:15)
    at execNext (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/@log4brains/web/dist/lib/console.js:20:11)
    at buildCommand (/Users/peteresselius/.npm/prefix/lib/node_modules/log4brains/node_modules/@log4brains/web/dist/cli/commands/build.js:44:11)
[Next]  

any update on this:
following is the line that's breaking

app.incrementalCache.incrementalOptions.dev = true; // eslint-disable-line @typescript-eslint/no-unsafe-member-access

I'm having the same issue. Tried downgrading log4brains but it did not work unfortunately.

Same issue here, neither preview nor build is working, not on Ubuntu and not on Windows.
My env:
Ubuntu 18.04.5 LTS
Node v14.16.0
npm 6.14.11

Reproduced in

WSL2 : Ubuntu 20.04
Node : v14.16.0
Npm : 7.7.0

Hi all!
I am very sorry for my long absence...
Leaving a bug like this one not resolved for 2 months is just a shame!! 😱
I had a lot of work in March and got the Covid at the beginning of April (hopefully not severe!) but from now on I will be able to work on the project again in my spare time! 🙏

And hopefully, the bug is now fixed! You can test by running:

npm uninstall -g log4brains
npm install -g log4brains

I also tried with npm update -g log4brains but I encountered this error:

/usr/local/lib/node_modules/log4brains/node_modules/next/dist/compiled/compression/index.js:1
ReferenceError: __nccwpck_require__ is not defined
    at __webpack_require__ (/usr/local/lib/node_modules/log4brains/node_modules/next/dist/compiled/compression/index.js:1)
    at /usr/local/lib/node_modules/log4brains/node_modules/next/dist/compiled/compression/index.js:1
    at Object.<anonymous> (/usr/local/lib/node_modules/log4brains/node_modules/next/dist/compiled/compression/index.js:1)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)

It seems like Next.js does not like to be downgraded!

The fix is explained in this PR: #30
As you can see, it was because I didn't pin correctly the version of Next.js.
It broke very fast because I rely heavily on Next.js internal architecture, but I fear a similar issue can happen again in the future with some other dependencies.
That's why I started this discussion to look for a solution: #33
I would love to hear your opinions on this!

@thomvaill Hope you're feeling better! :)

I think everyone's excited to have the best ADR-tool working again! :)

Dutzu commented

Hey there, Issue seems to have popped up again in 1.0.0-beta.12. Same line, same error....

I also got the error (starting) with 1.0.0-beta.12. Updating to 1.0.0-beta.13 did not help.

[==  ] Log4brains is starting... Error

 FATAL  Cannot read property 'incrementalOptions' of undefined

I also tried:

npm uninstall -g log4brains
npm install -g log4brains

...but it did not help. Did anyone already open a new bug or is there a workaround?

Ah... I also had an issue when upgrading from 1.0.0-beta.12 to 1.0.0-beta.13 but I thought it was because of my local development setup.
Could you try this to see if it fixes the problem?

npm uninstall -g log4brains
rm -rf "$(npm root -g)/log4brains"
npm install -g log4brains

I close this issue. Let's continue the discussion on #80