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
When using the JMESPath utility I should be able to minify my code and all the utility's features should work.
Current Behaviour
When the function including the utility is minified the utility is not able to introspect its own methods and correctly register the functions available, which causes a runtime error:
2024-04-17T08:03:11.119Z a71a8744-df90-4187-bff6-d8f8e0d0478d ERROR Invoke Error {"errorType":"TypeError","errorMessage":"t.introspectMethods is not a function or its return value is not iterable","stack":["TypeError: t.introspectMethods is not a function or its return value is not iterable"," at Object.introspectMethods (/var/task/index.js:2:12877)"," at l.introspectMethods (/var/task/index.js:2:12877)"," at U.introspectMethods (/var/task/index.js:2:12877)"," at new ue (/var/task/index.js:2:16337)"," at he.search (/var/task/index.js:2:20094)"," at Le (/var/task/index.js:2:30000)"," at Runtime.Sr [as handler] (/var/task/index.js:2:31173)"," at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1173:29)"]}
This affects both ESM and CJS builds and can be mitigated only by not aliasing functions/methods names in the minified bundle - in esbuild this corresponds to the keepNames field.
On the other hand, if you also enable the --keepNames flag, the error won't occur.
Possible Solution
Refactor this method used to register the available methods to not rely on the prototype, or statically define the methods beforehand if that's not possible.
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
20.x
Packaging format used
Lambda Layers, npm
Execution logs
No response
The text was updated successfully, but these errors were encountered:
Expected Behaviour
When using the JMESPath utility I should be able to minify my code and all the utility's features should work.
Current Behaviour
When the function including the utility is minified the utility is not able to introspect its own methods and correctly register the functions available, which causes a runtime error:
This affects both ESM and CJS builds and can be mitigated only by not aliasing functions/methods names in the minified bundle - in
esbuild
this corresponds to thekeepNames
field.Code snippet
Steps to Reproduce
Bundle the function above and minify it:
Then deploy and observe the error.
On the other hand, if you also enable the
--keepNames
flag, the error won't occur.Possible Solution
Refactor this method used to register the available methods to not rely on the prototype, or statically define the methods beforehand if that's not possible.
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
20.x
Packaging format used
Lambda Layers, npm
Execution logs
No response
The text was updated successfully, but these errors were encountered: