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

[BUG] ERR_PACKAGE_PATH_NOT_EXPORTED issue encountered when upgrading to NodeJS 18 runtime #560

Closed
rayhive opened this issue Jul 14, 2023 · 8 comments
Labels
🐛 bug Something isn't working

Comments

@rayhive
Copy link

rayhive commented Jul 14, 2023

What is the bug?

We've had the "@opensearch-project/opensearch" working in an app running against the Node JS 14 runtime. Howerver we've recently tried upgrading our app's runtime to NodeJS 18 and experience the issue below.

ERROR Uncaught Exception {"errorType":"Error","errorMessage":"Package subpath './lib/errors' is not defined by \"exports\" in /var/task/node_modules/@opensearch-project/opensearch/package.json","code":"ERR_PACKAGE_PATH_NOT_EXPORTED","stack":["Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/errors' is not defined by \"exports\" in /var/task/node_modules/@opensearch-project/opensearch/package.json"," at new NodeError (node:internal/errors:399:5)

How can one reproduce the bug?

Import a module like: import { ResponseError } from '@opensearch-project/opensearch/lib/errors';

What is the expected behavior?

module imports without errors

What is your host/environment?

  • NodeJS 18.16.1,
  • @opensearch-project/opensearch": "2.1.0". Also tried it on versions "2.3.0", "2.2.1", "1.2.0"
@rayhive rayhive changed the title ERR_PACKAGE_PATH_NOT_EXPORTED issue encountered when upgrading to NodeJS 18 runtime [BUG] ERR_PACKAGE_PATH_NOT_EXPORTED issue encountered when upgrading to NodeJS 18 runtime Jul 14, 2023
@nhtruong
Copy link
Collaborator

@rayhive thanks for bringing this to our attention. Do you encounter this in other versions of Node as well? Esp the newer ones?

@rayhive
Copy link
Author

rayhive commented Jul 19, 2023

Hi @nhtruong, thanks for your response. We encountered this issue with the NodeJS 16, as well as 18 runtimes. Ideally we're looking to upgrade our runtime from version 14 to version 18.

@mahajanvivektech
Copy link

Is there an ETA as it's a kind of a blocker for us ?
@nhtruong

@nhtruong
Copy link
Collaborator

@mahajanvivektech Our integration and unit tests do include 18.x and they don't encounter this error. Lemme see if I can recreate this.

@nhtruong
Copy link
Collaborator

Is this what you're looking for?

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

console.log(errors.ResponseError)

@mahajanvivektech
Copy link

mahajanvivektech commented Jul 23, 2023

Hi @nhtruong,

Yeah, Thanks for sharing:

export declare class ResponseError<

We will give it a shot and let you know if it works

@rayhive
Copy link
Author

rayhive commented Jul 23, 2023

Is this what you're looking for?

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

console.log(errors.ResponseError)

Thanks for that @nhtruong, that's resolved the issue running this locally on my workstation - also, I upgraded to @opensearch-project/opensearch 2.3.1. We'll give this a test in the office, otherwise looking good, cheers.

@nhtruong
Copy link
Collaborator

Glad that was resolved. I'm going to close this ticket then.

@wbeckler wbeckler added the 🐛 bug Something isn't working label Oct 3, 2023
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

4 participants