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

Problems while individually packaging #255

Open
k-ogawa-1988 opened this issue May 4, 2021 · 2 comments
Open

Problems while individually packaging #255

k-ogawa-1988 opened this issue May 4, 2021 · 2 comments

Comments

@k-ogawa-1988
Copy link

k-ogawa-1988 commented May 4, 2021

Versions:

This plugin: 4.0.0

Operating System:          darwin
Node Version:              14.16.1
Framework Version:         2.39.1 (local)
Plugin Version:            4.5.3
SDK Version:               4.2.2
Components Version:        3.9.1

Problem no.1

When package.artifact is specified as empty string, sls package works fine.

# serverless.yml

package:
  individually: true
  patterns:
    - '!.gitignore'
    - '!node_modules/**'
    - '!package.json'
    - '!yarn.lock'
  artifact: ''

But sls package fails when package.artifact is not specified.

# serverless.yaml

package:
  individually: true
  patterns:
    - '!.gitignore'
    - '!node_modules/**'
    - '!package.json'
    - '!yarn.lock'

Error

  TypeError: Cannot read property 'split' of undefined
      at GooglePackage.compileFunctions (/path/to/cloud_functions/node_modules/serverless-google-cloudfunctions/package/lib/compileFunctions.js:13:39)
      at GooglePackage.tryCatcher (/path/to/cloud_functions/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/path/to/cloud_functions/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/path/to/cloud_functions/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromiseCtx (/path/to/cloud_functions/node_modules/bluebird/js/release/promise.js:641:10)
      at _drainQueueStep (/path/to/cloud_functions/node_modules/bluebird/js/release/async.js:97:12)
      at _drainQueue (/path/to/cloud_functions/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/path/to/cloud_functions/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/path/to/cloud_functions/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (internal/timers.js:461:21)

/package/lib/compileFunctions.js

image

Problem no.2

Under functions.func_name, package causes validation warning when sls package even if there's an official document.

# serverless.yml

package:
  individually: true
  patterns:
    - '!.gitignore'
    - '!node_modules/**'
    - '!package.json'
    - '!yarn.lock'
    - '!src/**'
  artifact: ''

functions:
  listUsers:
    package:
      patterns:
        - 'src/list_users/**'
    handler: list_users
    memorySize: 128
    timeout: 60s
    events:
      - http: path

Warning

Serverless: Configuration warning at 'functions.listUsers': unrecognized property 'package'
Serverless:  
Serverless: Learn more about configuration validation here: http://slss.io/configuration-validation

Note : generated .zip files looks fine.

Problem no.3

sls deploy with configuration below (including package.individually = true, package.artifact = '' and functions.func_name.package) causes error.

# serverless.yml

package:
  individually: true
  patterns:
    - '!.gitignore'
    - '!node_modules/**'
    - '!package.json'
    - '!yarn.lock'
  artifact: ''

functions:
  listUsers:
    package:
      patterns:
        - 'src/list_users/**'
    handler: list_users
    memorySize: 128
    timeout: 60s
    events:
      - http: path

Error

(no stacktrace)

yarn run v1.22.10
$ /path/to/cloud_functions/node_modules/.bin/sls deploy
Serverless: Deprecation warning: CLI options definitions were upgraded with "type" property (which could be one of "string", "boolean", "multiple"). Below listed plugins do not predefine type for introduced options:
             - GoogleLogs for "count"
            Please report this issue in plugin issue tracker.
            Starting with next major release, this will be communicated with a thrown error.
            More Info: https://www.serverless.com/framework/docs/deprecations/#CLI_OPTIONS_SCHEMA
Serverless: Configuration warning at 'functions.listUsers': unrecognized property 'package'
Serverless:  
Serverless: Learn more about configuration validation here: http://slss.io/configuration-validation
Serverless:  
Serverless: Deprecation warning: Starting with next major, Serverless will throw on configuration errors by default. Adapt to this behavior now by adding "configValidationMode: error" to service configuration
            More Info: https://www.serverless.com/framework/docs/deprecations/#CONFIG_VALIDATION_MODE_DEFAULT
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Compiling function "listUsers"...
Serverless: Uploading artifacts...
 
 Error ---------------------------------------------------
 
  Error: ENOENT: no such file or directory, open ''
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              14.16.1
     Framework Version:         2.39.1 (local)
     Plugin Version:            4.5.3
     SDK Version:               4.2.2
     Components Version:        3.9.1
 
Serverless: Artifacts successfully uploaded...
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Note: when turning off indiviaullly packaging, deploy works well but it may contain unused files (e.g. other function's code).

How can I work around this?

@CorentinDoue
Copy link
Contributor

Hello,
Individual packaging is not supported yet by this package.

#261 adds it but is not ready. Feel free to help :)

@El-Fitz
Copy link

El-Fitz commented Jun 10, 2021

Any help is more than welcome; I’m figuring it out as I go ^^’

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