You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dreamorosi opened this issue
Oct 22, 2024
· 3 comments
· Fixed by #3293
Assignees
Labels
completedThis item is complete and has been merged/shippedinternalPRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)parserThis item relates to the Parser Utility
When using the Middy.js middleware for parser, customers can specify envelopes and schemas for the middleware to use to parse the event. To ease usage for customers, we introduced types that are supposed to infer the event type based on the arguments passed to the middleware.
Currently when using envelopes, the type of the event is always assumed to be an array when it should not be the case.
Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
The text was updated successfully, but these errors were encountered:
dreamorosi
added
confirmed
The scope is clear, ready for implementation
internal
PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
parser
This item relates to the Parser Utility
labels
Oct 22, 2024
This is strange. While WebStorm shows me non array inferred type for both EventBridgeEnvelope and SqsEnvelope, VSCode shows an array of the custom schema also for both envelopes. I have also tested Zed, it has the same behaviour as VSCode (but faster 😄 ).
Seems like WebStorm is inferring the wrong type
Just reindexed everything and WebStorm now shows correct type inference.
completedThis item is complete and has been merged/shippedinternalPRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)parserThis item relates to the Parser Utility
Summary
When using the Middy.js middleware for parser, customers can specify envelopes and schemas for the middleware to use to parse the event. To ease usage for customers, we introduced types that are supposed to infer the
event
type based on the arguments passed to the middleware.Currently when using envelopes, the type of the
event
is always assumed to be an array when it should not be the case.For example, this is correct:
but this is not:
In the second case, EventBridge's
detail-type
field is an object and not an array, but the types here think it's always an array.Why is this needed?
So that the types when using the Middy.js middleware are correct.
Which area does this relate to?
Parser
Solution
No response
Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.
The text was updated successfully, but these errors were encountered: