diff --git a/lib/deploy/stepFunctions/compileStateMachines.test.js b/lib/deploy/stepFunctions/compileStateMachines.test.js index 93ffefb7..375e79eb 100644 --- a/lib/deploy/stepFunctions/compileStateMachines.test.js +++ b/lib/deploy/stepFunctions/compileStateMachines.test.js @@ -711,4 +711,35 @@ describe('#compileStateMachines', () => { expect(params).to.haveOwnProperty(functionParam2); expect(params[functionParam2]).to.eql({ Ref: 'MyFunction2' }); }); + + it('should allow null values #193', () => { + serverless.service.stepFunctions = { + stateMachines: { + myStateMachine1: { + id: 'Test', + name: 'test', + definition: { + StartAt: 'AnyStep', + States: { + AnyStep: { + Type: 'Pass', + ResultPath: null, + Next: 'Finish', + }, + Finish: { + Type: 'Succeed', + }, + }, + }, + }, + }, + }; + + serverlessStepFunctions.compileStateMachines(); + const stateMachine = serverlessStepFunctions.serverless.service + .provider.compiledCloudFormationTemplate.Resources + .Test; + + expect(stateMachine.Properties.DefinitionString).to.not.equal(null); + }); }); diff --git a/lib/utils/aws.js b/lib/utils/aws.js index 4b3a10ba..0abed9bb 100644 --- a/lib/utils/aws.js +++ b/lib/utils/aws.js @@ -1,5 +1,7 @@ +const _ = require('lodash'); + function isIntrinsic(obj) { - return typeof obj === 'object' && + return _.isObjectLike(obj) && Object.keys(obj).some((k) => k.startsWith('Fn::') || k.startsWith('Ref')); }