Closed paul-uz closed 2 days ago
Looks like there are other issues with that package, which i hit after stubbing tty.
I got a similar error to this one https://github.com/awslabs/llrt/issues/608
I have done some research as well. As you have pointed out, there seem to be some issues.
The following modules and functions are not implemented:
And even if you could implement these, you would probably get an error at this line. This is issue #608 itself.
module.exports = require('./common')(exports);
@paul-uz , As LLRT's Node.js package reading becomes browser-first, the required modules are changing. I already no longer need tty
and util
on my laptop. Currently, the required components are as follows.
node_modules/@opensearch-project/opensearch/lib/Transport.js:
There may be more, but first I will share where we are. :)
P.S. If you are using bundler, I recommend you to use platform: “browser”
as it has a better chance of working.
@paul-uz , As LLRT's Node.js package reading becomes browser-first, the required modules are changing. I already no longer need
tty
andutil
on my laptop. Currently, the required components are as follows.node_modules/@opensearch-project/opensearch/lib/Transport.js:
- os.arch()
- Buffer.constants.MAX_LENGTH
- Buffer.constants.MAX_STRING_LENGTH
- v8.getHeapStatistics().heap_size_limit
There may be more, but first I will share where we are. :)
P.S. If you are using bundler, I recommend you to use
platform: “browser”
as it has a better chance of working.
Sorry, what does this mean exactly?
Also, I thought you had to use browser as the platform for LLRT anyway?
I can't say it will necessarily work with that, but it is worth a try.
For reference, the @aws-sdk
bundled inside LLRT is built with platform: “browser”
. I believe this is to avoid Node.js-specific implementations included in @aws-sdk
and @smithy
, and to use the browser-oriented implementation.
The same could be said for general packages. However, if the package is not prepared with a browser-oriented implementation, this approach makes no sense.
There are many libraries that require the isatty function, such as https://github.com/chalk/chalk
import tty from 'node:tty';
const supportsColor = {
stdout: createSupportsColor({isTTY: tty.isatty(1)}),
stderr: createSupportsColor({isTTY: tty.isatty(2)}),
};
Basic support added in https://github.com/awslabs/llrt/pull/675
I am trying to use the following package https://www.npmjs.com/package/@opensearch-project/opensearch?activeTab=readme but I'm currently blocked due to the
tty
library not being supported.Being able to use this package is of great importance, as AWS do not have a true "client" library for OS (the one in the v3 SDK if for management of OS services, not for running queries).
Other than trying to get the OS package authors to remove the dependency on the packages that need tty, how can I resolve this?