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

Deprecation warning when using Node 16 and Typescript #365

Open
dibell opened this issue Jan 20, 2023 · 0 comments
Open

Deprecation warning when using Node 16 and Typescript #365

dibell opened this issue Jan 20, 2023 · 0 comments
Labels
🐛 bug Something isn't working

Comments

@dibell
Copy link

dibell commented Jan 20, 2023

When using Node 16 I see a deprecation warning when using the ResponseError exported from a subpath.

[DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at ./opensearchplay/node_modules/@opensearch-project/opensearch/package.json. Update this package.json to use a subpath pattern like "./*".

Here is a short example to reproduce this when run with ts-node:

import { Client } from '@opensearch-project/opensearch';
import { ResponseError } from '@opensearch-project/opensearch/lib/errors';

const client = new Client({ node: 'http://admin:admin@localhost:9200' });

const describeIndex = async () => {
    try {
        const response = await client.indices.get({ index: 'doesnotexist' });
        console.log(response.body);
    } catch (err) {
        if (err instanceof ResponseError) console.log(err.message, err.statusCode, err.meta.body.result);
        else console.log(err);
    }
};

describeIndex().catch((err) => console.error(err));

I guess either update the package.json exports to .* as suggested in the warning or export ResponseError from the root?

TIA

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