llrt icon indicating copy to clipboard operation
llrt copied to clipboard

@smithy/node-http-handler not included

Open paul-uz opened this issue 1 year ago • 7 comments

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

paul-uz avatar Aug 01 '24 14:08 paul-uz

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 avatar Aug 01 '24 20:08 paul-uz

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?

paul-uz avatar Aug 01 '24 22:08 paul-uz

Http is present, but there might be a bug.

Sytten avatar Aug 01 '24 22:08 Sytten

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

nabetti1720 avatar Aug 01 '24 22:08 nabetti1720

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

Sytten avatar Aug 02 '24 02:08 Sytten

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?

paul-uz avatar Aug 02 '24 06:08 paul-uz

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

Sytten avatar Aug 02 '24 10:08 Sytten

any updates?

paul-uz avatar Sep 11 '24 21:09 paul-uz

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!

richarddavison avatar Sep 20 '24 06:09 richarddavison

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.

paul-uz avatar Sep 20 '24 08:09 paul-uz

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? :)

richarddavison avatar Sep 20 '24 11:09 richarddavison

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.

paul-uz avatar Sep 26 '24 10:09 paul-uz