I was attempting to diagnose an issue brought up in #13 , where one of the troubleshooting steps was to run gatsby build. When running this, or npm run build, gatsby-plugin-typesense fails with the following output:
ERROR #11321 PLUGIN
"gatsby-plugin-typesense" threw an error while running the onPostBuild lifecycle:
exclude.test is not a function
102 | // backward compatibility
103 | rootDir = rootDir || publicDir
> 104 | const htmlFiles = await utils.getHTMLFilesRecursively(rootDir, rootDir, exclude)
| ^
105 |
106 | const typesense = new TypesenseClient(server)
107 | const newCollectionName = generateNewCollectionName(collectionSchema)
File: node_modules/gatsby-plugin-typesense/gatsby-node.js:104:21
TypeError: exclude.test is not a function
- utils.js:13
[website]/[gatsby-plugin-typesense]/lib/utils.js:13:32
- Array.map
- utils.js:7 Object.exports.getHTMLFilesRecursively
[website]/[gatsby-plugin-typesense]/lib/utils.js:7:13
- gatsby-node.js:104 Object.exports.onPostBuild
[website]/[gatsby-plugin-typesense]/gatsby-node.js:104:21
- api-runner-node.js:487 runAPI
[website]/[gatsby]/src/utils/api-runner-node.js:487:16
not finished onPostBuild - 0.131s
Steps to reproduce
I currently run a local copy of the Typesense Server on my machine with the following command:
docker run -i -p 8108:8108 -v/tmp/typesense-server-data/:/data typesense/typesense:0.19.0 --data-dir /data --api-key=redacted --listen-port 8108 --enable-cors
And i'm using the sample search component provided in the readme:
import * as React from 'react';
import { InstantSearch, SearchBox, Hits, Stats } from "react-instantsearch-dom"
import TypesenseInstantSearchAdapter from "typesense-instantsearch-adapter"
const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
server: {
apiKey: "redacted", // Be sure to use the search-only-api-key
nodes: [
{
host: "localhost",
port: "8108",
protocol: "http",
},
],
},
// The following parameters are directly passed to Typesense's search API endpoint.
// So you can pass any parameters supported by the search endpoint below.
// queryBy is required.
additionalSearchParameters: {
query_by: "postTitle,postCategory",
},
})
const searchClient = typesenseInstantsearchAdapter.searchClient
export default function SearchInterfaceDesktop() {
const Hit = ({ hit }) => (
<p>
{hit.title} - {hit.description}
</p>
)
return (
<InstantSearch searchClient={searchClient} indexName="posts_v1">
<SearchBox />
<Stats />
<Hits hitComponent={Hit} />
</InstantSearch>
)
}
Expected Behavior
I expect the plugin to build the page schema and complete the build successfully.
Actual Behavior
gatsby-build fails with the error "exclude.test is not a function" under the gatsby-plugin-typesense plugin.
Small update: removing the exclude parameter from the plugin's options in gatsby-config.js seems to be a workaround, as the error doesn't show up with it not present.
Description
I was attempting to diagnose an issue brought up in #13 , where one of the troubleshooting steps was to run
gatsby build
. When running this, ornpm run build
, gatsby-plugin-typesense fails with the following output:Steps to reproduce
I currently run a local copy of the Typesense Server on my machine with the following command:
docker run -i -p 8108:8108 -v/tmp/typesense-server-data/:/data typesense/typesense:0.19.0 --data-dir /data --api-key=redacted --listen-port 8108 --enable-cors
My gatsby-config.js looks like this:
And i'm using the sample search component provided in the readme:
Expected Behavior
I expect the plugin to build the page schema and complete the build successfully.
Actual Behavior
gatsby-build
fails with the error "exclude.test is not a function" under thegatsby-plugin-typesense
plugin.Metadata
Typsense Version: 0.19.0 Plugin Version: 0.3.0
OS: Ubuntu Linux 21.10