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

Packaging functions individually causes "no serviceName.zip file found in the package path you provided" #6120

Closed
emibelli opened this issue May 10, 2019 · 5 comments · Fixed by #6537 or #6606

Comments

@emibelli
Copy link

emibelli commented May 10, 2019

This is a Bug Report

Description

sls deploy fails when packaging functions individually, but succeeds when not packaging functions individually (increasing package size and adding unnecessary files to Lambda function).

  • What went wrong?
    sls deploy fails when packaging functions individually.
  • What did you expect should have happened?
    sls deploy should deploy with individually packaged functions.
  • What was the config you used?
service: serviceName

provider:
  name: aws
  runtime: python3.7
  stage: ${opt:stage, 'dev'}
  iamRoleStatements:
    [redacted]
  versionFunctions: false
  package:
    individually: true
  environment:
    [redacted]

functions:
  function0:
    handler: src/handlers/function0.main
    name: ${opt:stage, self:provider.stage}-${self:service}-function0
    package:
      individually: true
      exclude:
        - "./**"
      include:
        - src/handlers/function0.py
        - README.md
    environment:
      [redacted]
    events:
      [redacted]
  function1:
    handler: src/handlers/function1.main
    name: ${opt:stage, self:provider.stage}-${self:service}-function1
    package:
      individually: true
      exclude:
        - "**/*"
      include:
        - src/handlers/function1.py
        - README.md
    environment:
      [redacted]
  function2:
    handler: src/handlers/function2.main
    name: ${opt:stage, self:provider.stage}-${self:service}-function2
    package:
      individually: true
      exclude:
        - "**/*"
      include:
        - src/handlers/function2.py
        - README.md
    environment:
      [redacted]
  function3:
    handler: src/handlers/function3.main
    name: ${opt:stage, self:provider.stage}-${self:service}-function3
    package:
      individually: true
      exclude:
        - "**/*"
      include:
        - src/handlers/function3.py
        - README.md
    environment:
      [redacted]
  function4:
    handler: src/handlers/function4.main
    name: ${opt:stage, self:provider.stage}-${self:service}-function4
    package:
      individually: true
      exclude:
        - "**/*"
      include:
        - src/handlers/function4.py
        - README.md
    environment:
      [redacted]
  function5:
    handler: src/handlers/function5.main
    name: ${opt:stage, self:provider.stage}-${self:service}-function5
    package:
      individually: true
      exclude:
        - "**/*"
      include:
        - src/handlers/function5.py
        - README.md
    environment:
      [redacted]
  function6:
    handler: src/handlers/function6.main
    name: ${opt:stage, self:provider.stage}-${self:service}-function6
    package:
      individually: true
      exclude:
        - "**/*"
      include:
        - src/handlers/function6.py
        - README.md
    environment:
      [redacted]

stepFunctions:
  stateMachines:
    stateMachine:
      name: ${opt:stage, self:provider.stage}-${self:service}
      definition:
        [redacted]

plugins:
  - serverless-offline
  - serverless-offline-scheduler
  - serverless-pseudo-parameters
  - serverless-step-functions
  - serverless-dotenv-plugin
  • What stacktrace or error message from your provider did you see?
$ sls deploy
Serverless: DOTENV: Loading environment variables from .env:
[redacted]
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
 
  Serverless Error ---------------------------------------
 
  No serviceName.zip file found in the package path you provided.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     OS:                     linux
     Node Version:           8.10.0
     Serverless Version:     1.42.2

Similar or dependent issues:

Additional Data

  • Serverless Framework Version you're using:
  Your Environment Information ---------------------------
     OS:                     linux
     Node Version:           8.10.0
     Serverless Version:     1.42.2
  • Operating System:
$ uname -a
Linux ip-[redacted] 4.14.97-74.72.amzn1.x86_64 #1 SMP Tue Feb 5 20:59:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Stack Trace: N/A
  • Provider Error messages: N/A
@emibelli
Copy link
Author

emibelli commented May 10, 2019

Removing functions.functionN.package.individually and leaving provider.package.individually: true does not package functions individually but makes deployment succeed.
Removing functions.functionN.package.individually and provider.package.individually does not package functions individually but makes deployment succeed.
Removing provider.package makes deployment fail with the same error.

@emibelli emibelli changed the title Packaging functions individually casues "no service-name.zip file found in the package path you provided" Packaging functions individually casues "no serviceName.zip file found in the package path you provided" May 10, 2019
@emibelli emibelli changed the title Packaging functions individually casues "no serviceName.zip file found in the package path you provided" Packaging functions individually causes "no serviceName.zip file found in the package path you provided" May 13, 2019
@emibelli
Copy link
Author

Hi! Is there any way I can help out with debugging or fixing this? Can someone point me to where I can start helping in fixing this?

@emibelli
Copy link
Author

emibelli commented Jun 5, 2019

Any updates on this?

@eduardimaa
Copy link

@emibelli
Hello, fine, you should remove the "package" from the "provider", then
from so much insisting I perceived this relation, after this negotiation I am having the expected result.
Hope this helps !!!

(Sorry for my bad English)

Example:

service: your-service
provider:
  name: aws
  runtime: nodejs8.10
  region: us-east-2
  apiName: your-api-name
  memorySize: 256

package:
  individually: true
  exclude:
    - "**/*"

functions:
  createItem:
    name: ${self:provider.stage}-name-your-function
    handler: name-your-handler
    reservedConcurrency: 5
    package:
      individually: true
      include:
      - utils/** 
      - services/dynamodbService.js
      - handlers/item/createItem.js
      exclude:
      - node_modules/**
      - '!node_modules/request/**'
      - '!node_modules/dynamo-update-expression/**'
    events:
      - http:
          path: item
          method: post

@mthenw
Copy link
Contributor

mthenw commented Aug 13, 2019

Hey,

I have a super simple example that helps reproducing that:

the following config DOESN'T work:

service: example-service

provider:
  name: aws
  runtime: go1.x
  region: eu-central-1

functions:
  example:
    handler: bin/example
    memorySize: 128
    package:
      individually: true
      exclude:
        - ./**
      include:
        - bin/example

the following config DOES work:

service: example-service

provider:
  name: aws
  runtime: go1.x
  region: eu-central-1

package:
  individually: true
  exclude:
    - ./**
  include:
    - bin/example

functions:
  example:
    handler: bin/example
    memorySize: 128

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