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
If this is executed for the first time, everything is fine. But, when executing it again, and there is a cached execution environment in AWS' Lambda execution environment already, the second execution will log warnings like this:
2021-04-21T11:26:02.545Z 9c68dea6-3a26-4ca5-88a7-cdb011eb06fe INFO WARNING: Both Create and AsyncCreate handlers defined. Ignoring AsyncCreate
2021-04-21T11:26:02.545Z 9c68dea6-3a26-4ca5-88a7-cdb011eb06fe INFO WARNING: Both Update and AsyncUpdate handlers defined. Ignoring AsyncUpdate
2021-04-21T11:26:02.545Z 9c68dea6-3a26-4ca5-88a7-cdb011eb06fe INFO WARNING: Both Delete and AsyncDelete handlers defined. Ignoring AsyncDelete
These warnings are misleading: There's nothing wrong really with the resource definition, but rather due to the caching the resource definition is now wrong. The first execution has added the Create, Update, and Delete definitions to it.
delete the AsyncCreate, AsyncUpdate, and AsyncDelete properties after adding the wrappers. This would change a parameter though, so as developer I would not expect this unless there's a huge warning somewhere in the docs. But ...
First create a copy of the resource definition, before modifying it would fix that.
Alternatively, and my preferred approach: Move the check and creation of the wrappers BEFORE the return function CfnLambda, so that these only get executed on the first call.
WDYT?
Also: Regardless of which fix is chosen, it would be nice to move from console.log('WARNING: ...') to console.warn('...') :)
The text was updated successfully, but these errors were encountered:
Assume the following code for a custom resource function:
If this is executed for the first time, everything is fine. But, when executing it again, and there is a cached execution environment in AWS' Lambda execution environment already, the second execution will log warnings like this:
These warnings are misleading: There's nothing wrong really with the resource definition, but rather due to the caching the resource definition is now wrong. The first execution has added the
Create
,Update
, andDelete
definitions to it.For quick reference:
cfn-lambda/index.js
Lines 34 to 50 in 8bad51a
I could see these options to fix this:
delete
theAsyncCreate
,AsyncUpdate
, andAsyncDelete
properties after adding the wrappers. This would change a parameter though, so as developer I would not expect this unless there's a huge warning somewhere in the docs. But ...return function CfnLambda
, so that these only get executed on the first call.WDYT?
Also: Regardless of which fix is chosen, it would be nice to move from
console.log('WARNING: ...')
toconsole.warn('...')
:)The text was updated successfully, but these errors were encountered: