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

v3.5.0 docusaurus upgrade failure #217

Closed
fartbagxp opened this issue Aug 9, 2024 · 3 comments
Closed

v3.5.0 docusaurus upgrade failure #217

fartbagxp opened this issue Aug 9, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@fartbagxp
Copy link

fartbagxp commented Aug 9, 2024

Please describe the bug you are seeing

As of v3.5.0 docusaurus release, there's some internal refactoring going so having this search plugin breaks on compiling on every file, it probably has to do with useContextualSearchFilters.

        Error: Can't render static file for pathname "/docs/example-doc"
            at generateStaticFile (/home/fartbagxp/test-doc/node_modules/@docusaurus/core/lib/ssg.js:119:15)
            at runNextTicks (node:internal/process/task_queues:60:5)
            at process.processImmediate (node:internal/timers:454:9)
            at async /home/fartbagxp/test-doc/node_modules/p-map/index.js:57:22 {
          [cause]: TypeError: (0 , lib_namespaceObject.useContextualSearchFilters) is not a function
              at SearchBar (server.bundle.js:66187:833)
              at Uc (server.bundle.js:73557:44)
              at Xc (server.bundle.js:73559:253)
              at Z (server.bundle.js:73565:89)
              at Yc (server.bundle.js:73568:98)
              at Xc (server.bundle.js:73560:145)
              at Z (server.bundle.js:73565:89)
              at Xc (server.bundle.js:73559:481)
              at Z (server.bundle.js:73565:89)
              at Yc (server.bundle.js:73568:98)
        }

How can we best reproduce the bug?

Build project with Docusaurus v3.5.0, use either v1.1.0 or v1.2.0 of the plugin and run docusaurus build.

Which version of Docusaurus and @cmfcmf/docusaurus-search-local are you using?

v1.1.0 and v1.2.0 both fail.

Which Node.js version are you using?

v20.16.0

Which theme are you using?

Yes, I am using @docusaurus/theme-classic

How does your plugin config look like?

  require.resolve('@cmfcmf/docusaurus-search-local'),
      {
        indexDocs: true,
        indexDocSidebarParentCategories: 0,
        indexBlog: true,
        indexPages: false,
        language: 'en',
        style: undefined,
        maxSearchResults: 8,
        lunr: {
          tokenizerSeparator: /[\s\-]+/,
          b: 0.75,
          k1: 1.2,
          titleBoost: 5,
          contentBoost: 1,
          tagsBoost: 3,
          parentCategoriesBoost: 2, // Only used when indexDocSidebarParentCategories > 0
        },
      },
    ],

Additional context

No response

@fartbagxp fartbagxp added the bug Something isn't working label Aug 9, 2024
@slorber
Copy link

slorber commented Aug 9, 2024

Sorry about this, it's my fault while refactoring code in facebook/docusaurus#10316

Although this API is not documented, it's not exported as /internal and so this change can be considered as a breaking change.

I will look into adding back retrocompatibility soon, so that this plugin works again.

@slorber
Copy link

slorber commented Aug 13, 2024

Docusaurus v3.5.2 has been released, fixing this retro-compatibility problem.


Note, it's possible that you get another error while building your site.

[ERROR] Error: Unable to build website for locale en.
  ...
  [cause]: TypeError: Cannot read properties of undefined (reading 'load')
      at getDocusaurusTag (.../@cmfcmf/docusaurus-search-local/lib/server/parse.js:194:33)
      at .../@cmfcmf/docusaurus-search-local/lib/server/index.js:288:60

It is a different issue, related to a recent release of Cheerio v1.0 that did unexpected breaking changes. See my PR for details and workarounds: #218

@fartbagxp
Copy link
Author

Thanks @slorber!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants