svdgraaf / serverless-fargate-tasks

Run Fargate tasks within your serverless project
43 stars 21 forks source link

Unable to deploy fargate task #10

Open dsylla opened 4 years ago

dsylla commented 4 years ago

Hi,

I'm trying to deploy a fargate task for a long running process but I keep getting this error

TypeError: Cannot read property 'LogGroupName' of undefined

Full trace : TypeError: Cannot read property 'LogGroupName' of undefined at /Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/node_modules/@serverless/lib/logsCollection.js:80:69 at Generator.next () at asyncGeneratorStep (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/node_modules/@serverless/enterprise-plugin/lib/logsCollection.js:3:103) at _next (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/node_modules/@serverless/enterprise-plugin/lib/logsCollection.js:5:194) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5) From previous event: at PluginManager.invoke (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/classes/PluginManager.js:483:22) at PluginManager.spawn (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/classes/PluginManager.js:503:17) at AwsPackage. (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/plugins/aws/package/index.js:70:41) From previous event: at Object.package:finalize [as hook] (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/plugins/aws/package/index.js:69:30) From previous event: at PluginManager.invoke (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/classes/PluginManager.js:483:22) at PluginManager.spawn (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/classes/PluginManager.js:503:17) at /Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:122:50 From previous event: at Object.before:deploy:deploy [as hook] (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:102:22) at /Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/classes/PluginManager.js:483:55 From previous event: at PluginManager.invoke (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/classes/PluginManager.js:483:22) at /Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/classes/PluginManager.js:518:24 From previous event: at PluginManager.run (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/classes/PluginManager.js:518:8) at /Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/Serverless.js:136:33 From previous event: at Serverless.run (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/lib/Serverless.js:123:74) at /Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/scripts/serverless.js:54:26 at processImmediate (internal/timers.js:456:21) at process.topLevelDomainCallback (domain.js:137:15) From previous event: at Object. (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/scripts/serverless.js:54:4) at Module._compile (internal/modules/cjs/loader.js:1151:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Module.require (internal/modules/cjs/loader.js:1040:19) at require (internal/modules/cjs/helpers.js:72:18) at Object. (/Users/david/.nvm/versions/node/v13.9.0/lib/node_modules/serverless/bin/serverless.js:41:1) at Module._compile (internal/modules/cjs/loader.js:1151:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47

This is my serverless.yml

plugins:

custom: fargate: vpc: security-groups:

Your Environment Information --------------------------- Operating System: darwin Node Version: 13.9.0 Framework Version: 1.78.0 Plugin Version: 3.7.0 SDK Version: 2.3.1 Components Version: 2.33.4

dazza-codes commented 4 years ago

Might be missing a 'DependsOn' e.g. maybe

TaskDefinition:
    Type: AWS::ECS::TaskDefinition
    # Makes sure the log group is created before it is used.
    DependsOn: FargateTasksLogGroup

Somewhere in https://github.com/svdgraaf/serverless-fargate-tasks/blob/develop/lib/index.js#L79-L108

IkKan commented 3 years ago

Hey @dsylla,

I was having the same issue and I managed to fix it. Posting the fix here in order to help you or someone else in the future.

Add this to custom section of your serveless.yml:

custom:
  enterprise:
    collectLambdaLogs: false

For anyone interested in this, problem is created by Serverless Enterprise Framework. Among other stuff Enterprise does, it is trying to pull Logs into Serverless Dashboard, however there is no filter for Fargate. Above settings disables this behavior.