Skip to content
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

Getting an error when running against my template #20

Open
roboweaver opened this issue Feb 14, 2018 · 1 comment
Open

Getting an error when running against my template #20

roboweaver opened this issue Feb 14, 2018 · 1 comment

Comments

@roboweaver
Copy link

roboweaver commented Feb 14, 2018

I see the following with my template - my suspicion is that it is the not handling the trigger section properly.

Robs-Mac-Pro:TrialAccountProvisionService robweaver$ serverless sam export --output ./sam-template-generated.yml --stage=dev --region=us-west-2
Serverless: Load command run
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command emit
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command sam
Serverless: Load command sam:export
Serverless: Invoke sam:export
Serverless: Working folder: /Users/robweaver/Sites/master/SharedDeployScripts/AWS/serverless/TrialAccountProvisionService/node_modules/serverless-sam
Serverless: Validate
Serverless: Preparing original CloudFormation template
Serverless: Packaging functions
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Export:
Serverless: Exporting resources
Serverless: Exporting resource: LogExpiryLambdaFunction
Serverless: Exporting resource: LogExpiry
Serverless: Exporting resource: AWSLambdaVPCAccessExecutionRole
Serverless: Exporting resource: TAPRole
Serverless: Exporting resource: TAPCustomersTable
Serverless: Exporting resource: TAPAlarmTopic
Serverless: Exporting resource: EventSourceMappingCreate
Serverless: Exporting resource: EventSourceMappingEmail
Serverless: Exporting resource: EventSourceMappingAlert
Serverless: Exporting resource: LambdaExecSecurityGroup
Serverless: Exporting outputs
Serverless: Exporting parameters
Serverless: Exporting conditions
Serverless: Exporting functions
Serverless: Exporting function: create as Create
Serverless: Exporting function: list as List
Serverless: Exporting function: get as Get
Serverless: Exporting function: getLoginURL as GetLoginURL
Serverless: Exporting function: getRandomLogin as GetRandomLogin
Serverless: Exporting function: update as Update
Serverless: Exporting function: delete as Delete
Serverless: Exporting function: triggerCreate as TriggerCreate
 
  Type Error ---------------------------------------------
 
  Cannot read property 'enabled' of null
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Stack Trace --------------------------------------------
 
TypeError: Cannot read property 'enabled' of null
    at FunctionConverter.isEventEnabled (/Users/robweaver/Sites/master/SharedDeployScripts/AWS/serverless/TrialAccountProvisionService/node_modules/serverless-sam/lib/FunctionConverter.js:120:18)
    at Object.keys.forEach (/Users/robweaver/Sites/master/SharedDeployScripts/AWS/serverless/TrialAccountProvisionService/node_modules/serverless-sam/lib/FunctionConverter.js:93:21)
    at Array.forEach (<anonymous>)
    at serverlessFunction.events.forEach (/Users/robweaver/Sites/master/SharedDeployScripts/AWS/serverless/TrialAccountProvisionService/node_modules/serverless-sam/lib/FunctionConverter.js:91:33)
    at Array.forEach (<anonymous>)
    at FunctionConverter.serverlessFunctionToSam (/Users/robweaver/Sites/master/SharedDeployScripts/AWS/serverless/TrialAccountProvisionService/node_modules/serverless-sam/lib/FunctionConverter.js:85:33)
    at allFunctions.forEach (/Users/robweaver/Sites/master/SharedDeployScripts/AWS/serverless/TrialAccountProvisionService/node_modules/serverless-sam/lib/SamGenerator.js:119:32)
    at Array.forEach (<anonymous>)
    at SamGenerator.readFunctions (/Users/robweaver/Sites/master/SharedDeployScripts/AWS/serverless/TrialAccountProvisionService/node_modules/serverless-sam/lib/SamGenerator.js:109:20)
    at SamGenerator.generate (/Users/robweaver/Sites/master/SharedDeployScripts/AWS/serverless/TrialAccountProvisionService/node_modules/serverless-sam/lib/SamGenerator.js:58:10)
    at BbPromise (/Users/robweaver/Sites/master/SharedDeployScripts/AWS/serverless/TrialAccountProvisionService/node_modules/serverless-sam/index.js:206:46)
    at SamPlugin.exportSam (/Users/robweaver/Sites/master/SharedDeployScripts/AWS/serverless/TrialAccountProvisionService/node_modules/serverless-sam/index.js:203:12)
From previous event:
    at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:372:22)
    at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:403:17)
    at variables.populateService.then (/usr/local/lib/node_modules/serverless/lib/Serverless.js:102:33)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
    at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:89:74)
    at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:42:50)
    at <anonymous>
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless
 
  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           8.9.1
     Serverless Version:     1.26.0

This is the first place I see 'enabled' in my serverless.yml:

 # Event that is triggered by the table log stream
  # Looks for events that are creating an account and starts that process
  triggerCreate:
    handler: users/triggerCreate.triggerCreate
    events:
          - stream: 
            # Get the stream to trigger on ...
            Fn::Join:
              - ""
              - - "arn:aws:dynamodb:${self:custom.region}::table/"
                - "Ref" : "TAPCustomersTable"
                - "/stream/"
                
#  # Event that is triggered by the table log stream
#  # Looks for events that are creating an account and starts that process
#  triggerCloningComplete:
#    handler: users/triggerCloningComplete.triggerCloningComplete
#    events:
#          - stream: 
#            # Get the stream to trigger on ...
#            Fn::Join:
#              - ""
#              - - "arn:aws:dynamodb:${self:custom.region}::table/"
#                - "Ref" : "TAPCustomersTable"
#                - "/stream/"
                
  # The function to check created items
  # This is a cron that looks at all records and tries to finish the cloning 
  # process that was started by triggerCreate (in case that times out)
  cronCreateCheck:
    handler: users/cronCreateCheck.cronCreateCheck
    events:
      # Schedule to run every 5 minutes
      - schedule: rate(1 minute)
        name: check-creation
        description: 'Check for creations every minute to update when cloning is complete'
        enabled: true
@undecidedapollo
Copy link

I had this same issue, I fixed it by indenting the attributes for the schedule event. From your example, it would look like this.

cronCreateCheck:
    handler: users/cronCreateCheck.cronCreateCheck
    events:
      # Schedule to run every 5 minutes
      - schedule: rate(1 minute)
          name: check-creation
          description: 'Check for creations every minute to update when cloning is complete'
          enabled: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants