weseek / growi

:anchor: GROWI - Team collaboration software using markdown
https://growi.org
MIT License
1.32k stars 221 forks source link

ElasticSearch: Unconfigured. #2886

Closed mzch closed 4 years ago

mzch commented 4 years ago

Environment

Host

item version
OS Debian 10.6
GROWI v4.1.8
node.js v12.18.3
npm 6.14.6
Using Docker no
Using growi-docker-compose no

(Accessing https://{GROWI_HOST}/admin helps you to fill in above versions)

Client

item version
OS
browser x.y.z

How to reproduce? (再現手順)

  1. Install ElasticSearch and plugins along the document.
  2. set Environment ELASTICSEARCH_URI=http://localhost:9200/growi
  3. Start Growi
  4. Open growi via browers
  5. Go Elasticsearch management
  6. Found UNCONFIGURED ERROR OCCURED ON SEARCH SERVICE

What happens? (症状)

Unable to connect ElasticSearch.

What is the expected result? (期待される動作)

Connect elasticsearch successfully.

yuki-takei commented 4 years ago

@mzch I couldn't reproduce the symptons you wrote.

mzch commented 4 years ago

Yes, curl http://localhost:9200/ returns as below:

{
  "name" : "optj19e",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "4AWzpY3sQjmn2eyA7OAgww",
  "version" : {
    "number" : "6.8.12",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "7a15d2a",
    "build_date" : "2020-08-12T07:27:20.804867Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.3",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
yuki-takei commented 4 years ago

GROWI server returns "search-service-unconfigured" when the initialization for SearchService is failed.

https://github.com/weseek/growi/blob/v4.1.8/src/server/routes/apiv3/search.js#L48

https://github.com/weseek/growi/blob/v4.1.8/src/server/service/search.js#L27

So I think some error should have been orrured when launching GROWI server. Would you paste logs for launching server especially logs by growi:service:search namespace?

mzch commented 4 years ago

The log when booting and visiting Full Text Search Management is as below:

growi@n08:~/growi$ yarn run server:prod
yarn run v1.22.4
$ npm run migrate
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1602595280125-0.12241570811780256/node but npm is using /srv/growi/.ndenv/versions/v12.18.3/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> growi@4.1.8 migrate /srv/growi/growi
> npm run migrate:up

npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1602595280125-0.12241570811780256/node but npm is using /srv/growi/.ndenv/versions/v12.18.3/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> growi@4.1.8 migrate:up /srv/growi/growi
> migrate-mongo up -f config/migrate.js

the options [useFindAndModify] is not supported
$ env-cmd -f config/env.prod.js node src/server/app.js
(node:27908) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
[2020-10-13T13:21:26.260Z]  INFO: growi:service:s2s-messaging:S2sMessagingServiceFactory/27908 on n08: Config pub/sub server is not defined.
[2020-10-13T13:21:31.767Z] DEBUG: growi:service:PassportService/27908 on n08: setting up serializer and deserializer
[2020-10-13T13:21:31.768Z] DEBUG: growi:service:PassportService/27908 on n08: LocalStrategy: reset
[2020-10-13T13:21:31.769Z] DEBUG: growi:service:PassportService/27908 on n08: LocalStrategy: setting up..
[2020-10-13T13:21:31.769Z] DEBUG: growi:service:PassportService/27908 on n08: LocalStrategy: setup is done
[2020-10-13T13:21:31.770Z] DEBUG: growi:service:PassportService/27908 on n08: LdapStrategy: reset
[2020-10-13T13:21:31.770Z] DEBUG: growi:service:PassportService/27908 on n08: SamlStrategy: reset
[2020-10-13T13:21:31.771Z] DEBUG: growi:service:PassportService/27908 on n08: OidcStrategy: reset
[2020-10-13T13:21:31.772Z] DEBUG: growi:service:PassportService/27908 on n08: BasicStrategy: reset
[2020-10-13T13:21:31.772Z] DEBUG: growi:service:PassportService/27908 on n08: GoogleStrategy: reset
[2020-10-13T13:21:31.772Z] DEBUG: growi:service:PassportService/27908 on n08: GoogleStrategy: setting up..
[2020-10-13T13:21:31.775Z] DEBUG: growi:service:PassportService/27908 on n08: GoogleStrategy: setup is done
[2020-10-13T13:21:31.775Z] DEBUG: growi:service:PassportService/27908 on n08: GitHubStrategy: reset
[2020-10-13T13:21:31.776Z] DEBUG: growi:service:PassportService/27908 on n08: GitHubStrategy: setting up..
[2020-10-13T13:21:31.776Z] DEBUG: growi:service:PassportService/27908 on n08: GitHubStrategy: setup is done
[2020-10-13T13:21:31.777Z] DEBUG: growi:service:PassportService/27908 on n08: TwitterStrategy: reset
[2020-10-13T13:21:31.777Z] DEBUG: growi:service:PassportService/27908 on n08: TwitterStrategy: setting up..
[2020-10-13T13:21:31.778Z] DEBUG: growi:service:PassportService/27908 on n08: TwitterStrategy: setup is done
[2020-10-13T13:21:31.785Z]  INFO: growi:service:search/27908 on n08: Initializing search delegator
[2020-10-13T13:21:31.785Z]  INFO: growi:service:search/27908 on n08: Elasticsearch (not Searchbox) is enabled
[2020-10-13T13:21:31.792Z] ERROR: growi:service:search/27908 on n08: Unexpected token '.'
  /srv/growi/growi/src/server/service/search-delegator/elasticsearch.js:313
        username: page.creator?.username,
                               ^

  SyntaxError: Unexpected token '.'
      at wrapSafe (internal/modules/cjs/loader.js:1053:16)
      at Module._compile (internal/modules/cjs/loader.js:1101:27)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
      at Module.load (internal/modules/cjs/loader.js:985:32)
      at Function.Module._load (internal/modules/cjs/loader.js:878:14)
      at Module.require (internal/modules/cjs/loader.js:1025:19)
      at require (internal/modules/cjs/helpers.js:72:18)
      at SearchService.initDelegator (/srv/growi/growi/src/server/service/search.js:52:38)
      at new SearchService (/srv/growi/growi/src/server/service/search.js:14:29)
      at Crowi.setupSearcher (/srv/growi/growi/src/server/crowi/index.js:356:24)
      at Crowi.init (/srv/growi/growi/src/server/crowi/index.js:103:10)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async Crowi.start (/srv/growi/growi/src/server/crowi/index.js:397:3)
[2020-10-13T13:21:43.394Z]  INFO: growi:crowi/27908 on n08: [production] Express server is listening on port 3000
(node:27908) DeprecationWarning: collection.count is deprecated, and will be removed in a future version. Use Collection.countDocuments or Collection.estimatedDocumentCount instead
[2020-10-13T13:23:00.709Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET / HTTP/1.1 200 24969 - Chrome 86.0 Mac OS X 10.15.7 342.708005 ms (req_id=2b6343f3-c5c4-498f-8566-3558ef2e2d12)
(node:27908) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
[2020-10-13T13:23:02.890Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /_api/users.list?user_ids=5f23b5a848c3565467006146 HTTP/1.1 200 412 https://letlive.info/ Chrome 86.0 Mac OS X 10.15.7 27.1336 ms (req_id=7bc68e9f-e00e-4338-8982-a7ae4f534e92)
[2020-10-13T13:23:02.912Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /_api/pages.getPageTag?pageId=5f23b5a848c3565467006149 HTTP/1.1 200 21 https://letlive.info/ Chrome 86.0 Mac OS X 10.15.7 40.372045 ms (req_id=f19b966e-0e65-4975-8fa8-eaa4c6a7b947)
[2020-10-13T13:23:02.918Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /_api/attachments.list?page_id=5f23b5a848c3565467006149 HTTP/1.1 200 28 https://letlive.info/ Chrome 86.0 Mac OS X 10.15.7 14.103814 ms (req_id=51df12c9-abad-4d45-9a25-9b7341dd8df7)
[2020-10-13T13:23:02.918Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /_api/v3/bookmarks/?pageId=5f23b5a848c3565467006149 HTTP/1.1 200 26 https://letlive.info/ Chrome 86.0 Mac OS X 10.15.7 19.751837 ms (req_id=5062a965-658b-4552-ade2-4c3d97409daa)
[2020-10-13T13:23:02.923Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /_api/v3/share-links/?relatedPage=5f23b5a848c3565467006149 HTTP/1.1 200 32 https://letlive.info/ Chrome 86.0 Mac OS X 10.15.7 14.418997 ms (req_id=d1ffc20c-0f24-4966-ac51-3d7f32b9ce64)
[2020-10-13T13:23:02.950Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /_api/v3/pages/recent HTTP/1.1 200 4793 https://letlive.info/ Chrome 86.0 Mac OS X 10.15.7 64.922224 ms (req_id=e72a1416-f89e-47d2-b1f9-728068835168)
[2020-10-13T13:23:03.068Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /_api/v3/bookmarks/?pageId=5f23b5a848c3565467006149 HTTP/1.1 200 26 https://letlive.info/ Chrome 86.0 Mac OS X 10.15.7 7.482203 ms (req_id=318179c0-0fa6-45d6-93bc-304c21b4b8ac)
[2020-10-13T13:23:05.579Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /admin HTTP/1.1 200 14079 https://letlive.info/ Chrome 86.0 Mac OS X 10.15.7 48.69784 ms (req_id=620e8d1c-4f9f-4535-bf51-c076158f6a9b)
[2020-10-13T13:23:06.268Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /_api/v3/admin-home/ HTTP/1.1 200 206 https://letlive.info/admin Chrome 86.0 Mac OS X 10.15.7 4.708479 ms (req_id=c957cdd2-ec40-4da9-8afe-20c0f0c119b4)
[2020-10-13T13:23:06.306Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /_api/v3/pages/recent HTTP/1.1 200 4793 https://letlive.info/admin Chrome 86.0 Mac OS X 10.15.7 35.41315 ms (req_id=7a20dba7-c99c-4ba3-8150-0a02b586955b)
[2020-10-13T13:23:08.923Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /admin/search HTTP/1.1 200 14132 https://letlive.info/admin Chrome 86.0 Mac OS X 10.15.7 27.676409 ms (req_id=b226eb95-b33c-4b6f-894e-b6de5ff3ea71)
[2020-10-13T13:23:09.256Z] ERROR: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /_api/v3/search/indices HTTP/1.1 503 95 https://letlive.info/admin/search Chrome 86.0 Mac OS X 10.15.7 6.363863 ms (req_id=fed6ce64-f4c9-4dd6-aeaa-618a72a36e7c)
[2020-10-13T13:23:09.293Z]  INFO: express/27908 on n08: ::ffff:127.0.0.1 <-- GET /_api/v3/pages/recent HTTP/1.1 200 4793 https://letlive.info/admin/search Chrome 86.0 Mac OS X 10.15.7 34.040912 ms (req_id=ddf546d1-5444-4d16-ad59-340c65c69297)
yuki-takei commented 4 years ago

@mzch Thank you for providing your log. I understand the bug is caused by Optional Chaining code available in Node.js v14 and above.

I'll fix it and release. Please wait.

mzch commented 4 years ago

Great! Thanks.