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

[NodeJS][TS2345] error when hookup nodejs client to dashboards #1122

Closed
ananzh opened this issue Jan 10, 2022 · 0 comments
Closed

[NodeJS][TS2345] error when hookup nodejs client to dashboards #1122

ananzh opened this issue Jan 10, 2022 · 0 comments
Assignees
Labels
nodejs 🍭 issues related to nodejs client v2.0.0

Comments

@ananzh
Copy link
Member

ananzh commented Jan 10, 2022

Describe the bug
See 20 TS2345 errors in two files when hook up nodejs to dashboards (related issue here ). Details are:

  • ensure_opensearch_version.ts
src/core/server/opensearch/version_check/ensure_opensearch_version.ts:211:5 - error TS2345: Argument of type 'OperatorFunction<number, unknown>' is not assignable to parameter of type 'OperatorFunction<number, NodesInfo>'. Type 'unknown' is not assignable to type 'NodesInfo'. 211  exhaustMap(() => {    ~~~~~~~~~~~~~~~~~~ 212  /*   ~~~~~~~~ ...  245  }   ~~~~~~~ 246  }),   ~~~~~~

src/core/server/opensearch/version_check/ensure_opensearch_version.ts:227:19 - error TS2345: Argument of type '({ body }: { body: any; }) => any' is not assignable to parameter of type '(value: unknown, index: number) => any'. Types of parameters '__0' and 'value' are incompatible. Type 'unknown' is not assignable to type '{ body: any; }'. 227  map(({ body }) => body),

src/core/server/opensearch/version_check/ensure_opensearch_version.ts:240:15 - error TS2345: Argument of type '({ body }: { body: any; }) => any' is not assignable to parameter of type '(value: unknown, index: number) => any'. Types of parameters '__0' and 'value' are incompatible. Type 'unknown' is not assignable to type '{ body: any; }'. 240  map(({ body }) => body),
  • opensearch_index.test.ts
src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:44:42 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 44  const info = await Index.fetchInfo(client, '.opensearch_dashboards_test');

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:69:36 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 69  await expect(Index.fetchInfo(client, '.baz')).rejects.toThrow(```

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:88:36 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 88  await expect(Index.fetchInfo(client, '.baz')).rejects.toThrow(

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:104:42 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 104  const info = await Index.fetchInfo(client, '.baz');

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:116:31 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 116  await Index.createIndex(client, '.abcd', { foo: 'bar' } as any);

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:134:31 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 134  await Index.deleteIndex(client, '.lotr');

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:149:30 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 149  await Index.claimAlias(client, '.hola-42', '.hola');

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:174:30 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 174  await Index.claimAlias(client, '.ze-index', '.muchacha');

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:197:30 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 197  await Index.claimAlias(client, '.ze-index', '.muchacha', [

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:242:9 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 242  client,

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:322:41 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 322  await expect(Index.convertToAlias(client, info, '.muchacha', 10)).rejects.toThrow(

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:382:25 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 382  await Index.write(client, index, docs);

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:461:33 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 461  const read = Index.reader(client, index, { batchSize: 100, scrollDuration: '5m' });

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:514:33 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 514  const read = Index.reader(client, index, {

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:531:33 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 531  const read = Index.reader(client, index, {

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:566:33 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. 566  const read = Index.reader(client, index, {

src/core/server/saved_objects/migrations/core/opensearch_index.test.ts:595:60 - error TS2345: Argument of type 'DeeplyMockedKeys<OpenSearchClient>' is not assignable to parameter of type 'MigrationOpenSearchClient'. Type 'DeeplyMockedKeys<OpenSearchClient>' is missing the following properties from type 'MigrationOpenSearchClient': bulk, cat, clearScroll, count, and 5 more. 595  const hasMigrations = await Index.migrationsUpToDate(client, index, migrations);

To Reproduce
Hook up nodejs client to dashboards using node-14. I have a hooked up branch here. Then after removind node-modules, run yarn osd bootstrap.

Expected behavior
Fix the error.

@ananzh ananzh added v2.0.0 nodejs 🍭 issues related to nodejs client labels Jan 10, 2022
@ananzh ananzh self-assigned this Jan 10, 2022
@ananzh ananzh closed this as completed Jan 26, 2022
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this issue Feb 10, 2022
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this issue Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nodejs 🍭 issues related to nodejs client v2.0.0
Projects
None yet
Development

No branches or pull requests

1 participant