rohit-gohri / redocusaurus

OpenAPI for Docusaurus with Redoc
https://redocusaurus.vercel.app/
MIT License
620 stars 113 forks source link

Build error - additionalLanguages #183

Closed AlexisTonneau closed 2 years ago

AlexisTonneau commented 2 years ago

Is anyone experiencing this error? I cannot perform a build anymore. I tried with different schema types and different versions but it didn't succeed

[ERROR] Docusaurus server-side rendering could not render static page with path "/api/".

TypeError: Cannot set properties of undefined (setting 'triple-quoted-string')
[ERROR] Unable to build website for locale en.
[ERROR] Error: Failed to compile with errors.
rohit-gohri commented 2 years ago

Can you tell which version of docusaurus and redocusaurus are you using?

AlexisTonneau commented 2 years ago
@docusaurus/core: 2.0.0-beta.20"
@docusaurus/preset-classic: 2.0.0-beta.20
redocusaurus: 1.1.0
Leander-van-Boven commented 2 years ago

I've also encountered this error, although for me the error was visible from the browser console, while the viewport was just an empty white page.

I already looked a bit into this, and I found out, it did not get this error when not specifying any additionalLanguages in prism config in docusaurus.config.js:

themeConfig: {
  prism: {
    additionalLanguages: []
  }
}

For me this 'solved' the problem, however, because I need syntax highlighting for languages not enabled by default in Prism, I sadly will have to hold off on Redocusaurus until this problem is fixed.

rohit-gohri commented 2 years ago

Can you add the error and stacktrace from the browser? Also your problem might be fixed by this comment: https://github.com/rohit-gohri/redocusaurus/issues/68#issuecomment-877902022

Maybe we should merge language settings and always add scala

Leander-van-Boven commented 2 years ago

Thanks, this solved the problem for me. Without 'scala' in the additionalLanguages this is the browser error + stack trace: image

rohit-gohri commented 2 years ago

@AlexisTonneau Are you also using additionalLanguages ?

rohit-gohri commented 2 years ago

Can you remove the scala language and try version v1.1.1 @Leander-van-Boven ? It should automatically add scala lang

AlexisTonneau commented 2 years ago

Yes, I added java in additionalLanguages property

rohit-gohri commented 2 years ago

@AlexisTonneau Does 1.1.1 fix your issue?

AlexisTonneau commented 2 years ago

No it doesn't. I noticed that it doesn't look to be related to prisma issue.

When I run docusaurus start, I get this issue on the website page (which wasn't the case in previous version):

Hook useColorMode is called outside the <ColorModeProvider>. Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.

But when I run docusaurus build, I get this error:

[ERROR] Docusaurus server-side rendering could not render static page with path "/api/".

ReactContextError
[ERROR] Unable to build website for locale en.
[ERROR] Error: Failed to compile with errors.
    at /Users/atonneau/Projects/onets/node_modules/@docusaurus/core/lib/webpack/utils.js:182:24
    at /Users/atonneau/Projects/onets/node_modules/webpack/lib/MultiCompiler.js:554:14
    at processQueueWorker (/Users/atonneau/Projects/onets/node_modules/webpack/lib/MultiCompiler.js:491:6)
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
rohit-gohri commented 2 years ago

That is same as https://github.com/rohit-gohri/redocusaurus/issues/174. Will see

rohit-gohri commented 2 years ago

Additional languages fixed in #187 and #174 fixed in #206

saul-data commented 3 months ago

I had the same issue with version 2.0.2

I added in java as an additional language. The fix was to add scala too.

      prism: {
        theme: prismThemes.github,
        darkTheme: prismThemes.dracula,
        additionalLanguages: ["bash", "csharp", "java", "php", "ruby", "scala"],
      },

Error:

Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'triple-quoted-string')
    at Object.extend (prism.js:345:16)
    at eval (prism-scala.js:1:41)
    at ./node_modules/prismjs/components/prism-scala.js (vendors-node_modules_docusaurus-theme-redoc_dist-jsx_theme_ApiDoc_index_js.js:2105:1)
    at __webpack_require__ (runtime~main.js:34:32)
    at fn (runtime~main.js:334:21)
    at eval (redoc.browser.lib.js:41:12173)
    at eval (redoc.browser.lib.js:1819:3806)
    at eval (redoc.browser.lib.js:1819:3811)
    at eval (redoc.browser.lib.js:2:37)
    at eval (redoc.browser.lib.js:2:43)