question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting function with Serverless Variables not working

See original GitHub issue

This is a Bug Report

Description

For bug reports:

  • What went wrong? Failure to deploy
  • What did you expect should have happened? Deployment
  • What was the config you used?
service: my-lambda-test # NOTE: update this with your service name

# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "= 1.15.4-alpha.1"

provider:
  name: aws
  runtime: python2.7
  # stage: dev
  region: us-east-1
  memorySize: 256 # optional, in MB, default is 1024
  timeout: 30 # optional, in seconds, default is 6
  versionFunctions: false # optional, default is true
  role: rolenameishere
  profile: cantsay
  deploymentBucket:
    # name: my.serverless.deployment.bucket.test
    serverSideEncryption: AES256

functions:
  test-lambda:
    handler: health-check/handler.hello # required, handler set in AWS Lambda
    name: test-lambda-stuff- # ${self:provider.stage} optional, Deployed Lambda name
    description: This is a test # optional, Description to publish to AWS
    runtime: python2.7 # optional overwrite, default is provider runtime
    memorySize: 512 # optional, in MB, default is 1024
    timeout: 10 # optional, in seconds, default is 6

  hello-world:
    handler: health-check/handler.hello
  • What stacktrace or error message from your provider did you see?

$ sls deploy -s dev -verbose Serverless: Packaging service…

Serverless Error ---------------------------------------

The stack service name “my-lambda-test-dev,true” is not valid. A service name should only contain alphanumeric (case sensitive) and hyphens. It should start with an alphabetic character and shouldn’t exceed 128 characters.

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: 7.8.0 Serverless Version: 1.15.4-alpha.1

If i uncomment the bucketname it becomes Could not locate deployment bucket. Error: this.getStage(…).toUpperCase is not a function

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
winstonewertcommented, Oct 10, 2017

At least part of the issue is that the correct verbose flag is --verbose not -verbose.

As it happens, the -s in -verbose sets the stage flag to true which doesn’t have a .toUpperCase() which is where the error comes from.

2reactions
samwiseduzercommented, Feb 9, 2018

I had the same issue, except that I incorrectly typed -stage instead of --stage

Read more comments on GitHub >

github_iconTop Results From Across the Web

Variables - Serverless Framework
Variables allow users to dynamically replace config values in serverless.yml config. They are especially useful when providing secrets for your service to use ......
Read more >
Lambda was unable to configure your environment variables
Lambda functions come with a set of default environment variables. These environment variable names are reserved, and users will not be able to...
Read more >
Serverless Environment Variables - A Comprehensive Guide
This guide is going to cover configuring Serverless environment variables for AWS Lambda running the Node.js 10.x runtime.
Read more >
Serverless option as default value for option not working
Stage and region each have a default, which can be overridden by an environment variable, which can in turn be overridden by a...
Read more >
Using Environment Variables with the Serverless Framework
Check that you're using Serverless 1.2 or later. · Try deploying the entire service and not just the function · Check that your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found