-
Notifications
You must be signed in to change notification settings - Fork 38
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
Type definition for tables()._db, tables()._doc is wrong for nodejs18.x runtime #540
Comments
This is an incomplete solution, because this makes types correct for the nodejs18.x runtime but incorrect for nodejs16.x and earlier. See architect#540.
Workaround for architect/functions#540.
Workaround for architect/functions#540.
Workaround for architect/functions#540.
Workaround for architect/functions#540.
Workaround for architect/functions#540.
I've just lost a chunk of time to this - pretty knotty thing to fix but at the very least it would be useful to add a comment to Happy to chip in with the fixes if that'd be useful. |
@TheWarBadger @lpsinger PRs def welcome! /cc @tbeseda |
Oh yikes. I hadn't thought about these types inherently changing based on the Node runtime. I don't use these types on the daily, so any ideas around how we might change the usage pattern here is welcome. Like is it easier to manually annotate types from specific imported types? as opposed to the implicit types provided when referencing Or maybe arc/fns implicitly types with SDK v3 but provides v2-based types that can be imported for handlers in Node14-16? |
What about providing two different type packages, one for AWS SDK v2 and one for AWS SDK v3? |
Or templating the types so that you can do |
@Ipsinger sounds good, I would suggest extending the API with some sensible run time protections - E.G. That said, I won’t be able to check this for a couple of days due to being AFK, but if using a type Union of |
What if the user is using a custom Lambda runtime that has node 16.x but the AWS SDK v3 installed? It would be better to attempt to import the V3 SDK and fall back to the V2 SDK if it is not installed. |
I would say that is not a use case we currently intend to support. It could be done, but it would add a fair bit of complexity for something that is, as far as I can tell, theoretical. I've yet to field a report of an Architect user doing this fwiw! |
A custom Lambda runtime is something that I have contemplated with my project. |
Use of Architect Functions in custom runtimes is totally fine and an intended use case! I'm referring specifically to a custom runtime where:
While inadvisable, there nothing fundamentally impossible or wrong with that approach, but it is an obscure set of circumstances that I don't think we need to support. Probably more likely would be a custom runtime that uses the |
Describe the issue
The type definitions for tables()._db and tables()._doc are wrong if the application is using the nodejs18.x AWS Lambda runtime. The types should come from the AWS SDK v2 if using the nodejs16.x runtime or earlier, and the AWSD SDK v3 if using the nodejs18.x runtime or later.
The text was updated successfully, but these errors were encountered: