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

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'map') #29

Open
Zamiell opened this issue Feb 8, 2023 · 1 comment

Comments

@Zamiell
Copy link

Zamiell commented Feb 8, 2023

Description

Hello,

I am a brand new TypeSense user. I am trying to move my existing Docusaurus website from Algolia --> TypeSense. I followed the steps from the documentation, and I cannot get it working.

My Docusaurus site is published to: https://isaacscript.github.io/

When attempting to type anything into the search, I get the following error in the JavaScript console:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'map')
    at t.value (37702.a034fb89.js:2:3949)
    at t.value (37702.a034fb89.js:2:8672)
    at 90888.529c7e8f.js:1:56429
    at p (37702.a034fb89.js:2:105125)
    at Generator.<anonymous> (37702.a034fb89.js:2:106462)
    at Generator.next (37702.a034fb89.js:2:105488)
    at jt (90888.529c7e8f.js:1:55241)
    at i (90888.529c7e8f.js:1:56585)

More Info

I am self-hosting TypeSense. I can see what the version is from the log file:

I20230208 07:07:05.562175 480505 typesense_server_utils.cpp:357] Starting Typesense 0.24.0

My "typesense-server.ini" looks like this:

; Typesense Configuration

[server]

api-address = 0.0.0.0
api-port = 8108
data-dir = /var/lib/typesense
api-key = 9AiKF0AGD145wC9fc4NafATcCam89XT7v2NxGf2ymFucN7b6
log-dir = /var/log/typesense

And the config in my "docusaurus.config.js" file is this:

      typesense: {
        typesenseCollectionName: "isaacscript",
        typesenseServerConfig: {
          nodes: [
            {
              host: "isaacracing.net",
              port: 8108,
              protocol: "https",
            },
          ],
          apiKey: "9AiKF0AGD145wC9fc4NafATcCam89XT7v2NxGf2ymFucN7b6",
        },

        typesenseSearchParameters: {},

        contextualSearch: true,
      },

For reference, the "docusaurus.config.js" file is located here:
https://github.com/IsaacScript/isaacscript/blob/main/packages/docs/docusaurus.config.js

Furthermore, I am using the following version of the plugin, which is located in my "package.json" file:

    "docusaurus-theme-search-typesense": "^0.9.0",

For reference, the "package.json" file is located here:
https://github.com/IsaacScript/isaacscript/blob/main/package.json

@Zamiell
Copy link
Author

Zamiell commented Feb 9, 2023

Turns out this was because I was incorrectly specifying the name of the collection in my Docusaurus settings. I propose that the runtime error should be changed to something more appropriate, like:

Failed to query the remote collection of "foo". Make sure that the configured collection name matches what is actually present on the remote Typesense server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant