awslabs / llrt

LLRT (Low Latency Runtime) is an experimental, lightweight JavaScript runtime designed to address the growing demand for fast and efficient Serverless applications.
Apache License 2.0
8.13k stars 359 forks source link

@smithy/node-http-handler not included #516

Closed paul-uz closed 1 month ago

paul-uz commented 3 months ago

Readme states @smithy packages are included, but I'm seeing an error trying to import @smithy/node-http-handler

paul-uz commented 3 months ago

Looks like the package is missing https://github.com/awslabs/llrt/blob/main/build.mjs#L109-L143.

Can it be added please, as its blocking my progress.

paul-uz commented 3 months ago

Hmm, so the deeper issue, and related to https://github.com/awslabs/llrt/issues/518 somewhat, is that http and https are not supported. What can I do in this situation? Do I have no choice but to abandon LLRT for these functions, and use LLRT for more "basic" functions that only deal with things like dynamodb?

Sytten commented 3 months ago

Http is present, but there might be a bug.

nabetti1720 commented 3 months ago

The http and https modules are not yet supported. Unfortunately, the http present in LLRT is just a directory name and does not function as a Node.js module name. See also: https://github.com/awslabs/llrt/issues/40

Sytten commented 3 months ago

Right, it seems missing but the primitives are there so it is probability just a matter of creating the module. Still waiting on a few things before moving it to llrt_modules

paul-uz commented 3 months ago

Right, it seems missing but the primitives are there so it is probability just a matter of creating the module. Still waiting on a few things before moving it to llrt_modules

Do you have a rough ETA?

Sytten commented 3 months ago

I am only helping on this repository @richarddavison can answer that

paul-uz commented 2 months ago

any updates?

richarddavison commented 2 months ago

Hi @paul-uz sorry for late reply. We do not support the @smithy/node-http-handler since it's a pure node dependency. If you bundle for browser, your bundler should automatically use the fetch-http-handler. Can you give me some more context on what you're trying to do and I'll take a look!

paul-uz commented 2 months ago

Trying to bundle functions that use the smithy http handler and it's simply not working due to the lack of http module.

Docs state smithy packages are covered but then you've just said they aren't.

I'll be honest, the documentation is pretty poor. I know this is early stages but the LLRT was recommended to us personally by someone at AWS but it's clearly not ready for usage yet.

richarddavison commented 2 months ago

Trying to bundle functions that use the smithy http handler and it's simply not working due to the lack of http module.

Smithy has many http handlers and @smithy/node-http-handler is built for Node.js and won't work out of the box. This is a low level component that can be replaced by @smithy/fetch-http-handler. All SDKs are agnostic to the http handler.

Docs state smithy packages are covered but then you've just said they aren't.

Unfortunately not every @smithy package since some of them depend on Node.js APIs.

I'll be honest, the documentation is pretty poor. I know this is early stages but the LLRT was recommended to us personally by someone at AWS but it's clearly not ready for usage yet.

We agree that documentation could be improved, there are a couple of gotchas when it comes to bundling, especially related to SDKs not bundled with the runtime. We are working on making this better. I'm sorry that your experience with LLRT is not living up to your expectations, we are constantly adding new capabilities and APIs to make the transition smoother. What SDK are you using that's not supported? Have you tried the -full-sdk.zip packages?

Would be great if you can provide some additional details or maybe a code sample? :)

paul-uz commented 1 month ago

I've mentioned which parts I'm having issues with, namely the credential provider.

It'd be good to get some well documented examples of some different Lambdas using different AWS SDKs.

Smithy has many http handlers and @smithy/node-http-handler is built for Node.js and won't work out of the box. This is a low level component that can be replaced by @smithy/fetch-http-handler. All SDKs are agnostic to the http handler.

Unfortunately, I wouldn't even know how to go about "replacing" the handler. In all honesty, if something doesn't work out of the box, I'm not going to invest much time in it.

The LLRT really piques my interest, so I want it to work. But it needs to be easier to port fucntions across.