Skip to content

Single Function Deploy Failure: Cannot set property 'artifact' of undefined #250

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

Closed
MrTeale opened this issue Sep 18, 2018 · 3 comments
Closed

Comments

@MrTeale
Copy link

MrTeale commented Sep 18, 2018

I'm running into an issue regarding deploying a single function. I can deploy all of the functions using sls deploy but I have the issue of Cannot set property 'artifact' of undefined whenever I attempt to deploy a single one. I have included my versions, a traceback of the issue and my serverless.yml file.

My versions are:
OS: darwin (specifically macOS Version 10.14 Beta (18A293u)
Node Version: 6.11.1
Serverless Version: 1.32.0
Serverless-python-requirements: 4.1.0

Below is my traceback from attempting to run a single function deploy:

Cosmos:PROJECT_ALPHA MrTeale$ sls deploy function -f strategy
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 config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command create_domain
Serverless: Load command delete_domain
Serverless: Load command requirements
Serverless: Load command requirements:clean
Serverless: Load command requirements:install
Serverless: WARNING: Missing "tenant" and "app" properties in serverless.yml. Without these properties, you can not publish the service to the Serverless Platform.
Serverless: Invoke deploy:function
Serverless: Installing requirements of src/api/requirements.txt in .serverless/src/api...
Serverless: Docker Image: lambci/lambda:build-python3.6
Serverless: Installing requirements of src/scheduler/requirements.txt in .serverless/src/scheduler...
Serverless: Docker Image: lambci/lambda:build-python3.6
Serverless: Installing requirements of src/strategy/requirements.txt in .serverless/src/strategy...
Serverless: Docker Image: lambci/lambda:build-python3.6
Serverless: Copying vendor libraries from ./src/parser to .serverless/src/strategy/requirements...
Serverless: Installing requirements of src/analysis/requirements.txt in .serverless/src/analysis...
Serverless: Docker Image: lambci/lambda:build-python3.6
Serverless: Invoke package:function
Serverless: Packaging function: strategy...
Serverless: Excluding development dependencies...
Serverless: Injecting required Python packages to package...

  Type Error ---------------------------------------------

  Cannot set property 'artifact' of undefined

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Stack Trace --------------------------------------------

TypeError: Cannot set property 'artifact' of undefined
    at BbPromise.resolve.filter.map.map.func (/Users/MrTeale/Desktop/PROJECT_ALPHA/node_modules/serverless-python-requirements/lib/inject.js:102:33)
From previous event:
    at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:390:22)
    at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:421:17)
    at variables.populateService.then.then (/usr/local/lib/node_modules/serverless/lib/Serverless.js:157:33)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
    at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:144:8)
    at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:43:50)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           6.11.1
     Serverless Version:     1.32.0

Serverless.yml file:

service: project-alpha

package:
    individually: true

plugins:
  - serverless-domain-manager
  - serverless-python-requirements

custom:
  pythonRequirements:
    dockerizePip: true
  schedulesTableName: 'schedules-table-${self:provider.stage}'
  usersTableName: 'users-table-${self:provider.stage}'
  strategiesTableName: 'strategies-table-${self:provider.stage}'
  customDomain:
    domainName: **INSERT DOMAIN HERE**
    basePath: ''
    stage: ${self:provider.stage}
    createRoute53Record: true

provider:
  name: aws
  runtime: python3.6
  stage: dev
  region: us-east-1
  profile: private
  logRetentionInDays: 1
  memorySize: 128

functions:
  api:
    module: src/api
    handler: wsgi.handler
    role: apiIAMRole
    events:
      - http:
          path: /
          method: ANY
          cors: true
      - http:
          path: '{proxy+}'
          method: ANY
          cors: true
  schedule:
    module: src/scheduler
    handler: schedule.main
    role: schedulerIAMRole
    events:
      - stream:
          type: dynamodb
          arn:
            Fn::GetAtt:
              - SchedulesDynamoDBTable
              - StreamArn
          batchSize: 1
          startingPosition: LATEST
          enabled: true
  strategy:
    module: src/strategy
    handler: strat.main
    role: strategyIAMRole
    vendor: ./src/parser
  analysis:
    module: src/analysis
    handler: analysis.main
    role: analysisIAMRole

resources:
  Resources:
    SchedulesDynamoDBTable:
      Type: 'AWS::DynamoDB::Table'
      Properties:
        AttributeDefinitions:
          - AttributeName: uniqueID
            AttributeType: S
        KeySchema:
          - AttributeName: uniqueID
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
        TableName: ${self:custom.schedulesTableName}
        StreamSpecification:
          StreamViewType: NEW_IMAGE
    UsersDynamoDBTable:
      Type: 'AWS::DynamoDB::Table'
      Properties:
        AttributeDefinitions:
          - AttributeName: username
            AttributeType: S
        KeySchema:
          - AttributeName: username
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
        TableName: ${self:custom.usersTableName}
    StrategiesDynamoDBTable:
      Type: 'AWS::DynamoDB::Table'
      Properties:
        AttributeDefinitions:
          - AttributeName: strategy
            AttributeType: S
        KeySchema:
          - AttributeName: strategy
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
        TableName: ${self:custom.strategiesTableName}
    apiIAMRole: ${file(./IAMroles.yml):apiIAMRole}
    schedulerIAMRole: ${file(./IAMroles.yml):schedulerIAMRole}
    strategyIAMRole: ${file(./IAMroles.yml):strategyIAMRole}
    analysisIAMRole: ${file(./IAMroles.yml):analysisIAMRole}

This is the current file structure.

screen shot 2018-09-18 at 10 06 01 pm

I'd really love any assistance in fixing this issue as it appears to have persisted from 4.0.3 as mentioned in #161 and is severely impacting having an efficient workflow.

Thanks in advance.

@cgrimal
Copy link

cgrimal commented Sep 18, 2018

Hi @MrTeale, I had the exact same issue, and was using @AndrewFarley's version but since its pull-request has now been merged, you should just use the latest version of the plugin (4.2.2).

If the problem is indeed the same as mine, it should work like a charm!

@MrTeale
Copy link
Author

MrTeale commented Sep 18, 2018

I completely didn't notice that there was a new version released. That has fixed my issue. Thank you so much

@MrTeale MrTeale closed this as completed Sep 18, 2018
@akzincsystems
Copy link

still a problem in 2020 (or the days before 2021) with an install only days old

sls deploy function --function myhandler

doesn't work

TypeError: Cannot read property 'artifact' of undefined
at ServerlessPythonRequirements.BbPromise.bind.then.then.then (/home/me/Projects/Python3/api-logon-py/node_modules/serverless-python-requirements/index.js:17
6:48)

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

3 participants