Git Product home page Git Product logo

serverless-framework-orb's Introduction

serverless-framework Orb

CircleCI Build Status CircleCI Orb Version GitHub License CircleCI Community

Use the Serverless Framework orb for CircleCI to easily deploy to your favorite cloud platform.

Usage

Example use-cases are provided on the orb registry page. Source for these examples can be found within the src/examples directory.

Resources

CircleCI Orb Registry Page - The official registry page of this orb for all versions, executors, commands, and jobs described. CircleCI Orb Docs - Docs for using and creating CircleCI Orbs.

How To Contribute

We welcome issues to and pull requests against this repository!

How to Publish An Update

  1. Merge pull requests with desired changes to the main branch.
  2. Find the current version of the orb.
    • You can run circleci orb info circleci/serverless-framework | grep "Latest" to see the current version.
  3. Create a new Release on GitHub.
    • Click "Choose a tag" and create a new semantically versioned tag. (ex: v1.0.0)
      • We will have an opportunity to change this before we publish if needed after the next step.
  4. Click "+ Auto-generate release notes".
    • This will create a summary of all of the merged pull requests since the previous release.
    • If you have used Conventional Commit Messages it will be easy to determine what types of changes were made, allowing you to ensure the correct version tag is being published.
  5. Now ensure the version tag selected is semantically accurate based on the changes included.
  6. Click "Publish Release".
    • This will push a new tag and trigger your publishing pipeline on CircleCI.

serverless-framework-orb's People

Contributors

dependabot[bot] avatar ericribeiro avatar jaryt avatar kyletryon avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-framework-orb's Issues

No output from sls deploy -v

serverless-framework: circleci/[email protected]

jobs:
  # # # # # # # # # # #
  #      BACKEND      #
  # # # # # # # # # # #
  deploy-backend:
      executor: serverless-framework/default
      steps:
        - checkout
        - aws-cli/setup
        - serverless-framework/setup
        - run:
            name: cd backend
            command: cd backend
        - run:
            name: deploy-backend
            command: sls deploy -v

image

I would expect there to be some output here. Why isn't there any? What steps should I take?

Receiving 404 when trying to download 3.7.5 binary

Orb Version

circleci/[email protected]

Describe the bug
build is currently failing due to 404 on version 3.7.5 of serverless

 Downloading binary for version 3.7.5...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   657  100   657    0     0   9385      0 --:--:-- --:--:-- --:--:--  9385
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404 
Could not download binary. Is the version correct?
Exited with code exit status 22

To Reproduce

Use orb and run - serverless/setup in your config

orbs:
  serverless: circleci/[email protected]

jobs:
  build:
    working_directory: ~/MyApp
    executor: serverless/default
    resource_class: large
    docker:
      - image: cimg/node:14.17.1
    steps:
      - checkout
      - serverless/setup

Expected behavior

No failures when trying to download latest version of serverless (3.7.5)

Additional context

Serverless framework just releases version 3.7.5 this morning (maybe 3 hours ago from this post, March 14) https://github.com/serverless/serverless/releases/tag/v3.7.5

syntax error near unexpected token `newline'

Orb Version
circleci/[email protected]

Describe the bug

  • The step "Install Serverless CLI" fails, after having worked for quite some time
  • Last successful run was Dec 5th, 2022 - 8 days ago, no CircleCI changes since then

image

To Reproduce

  • Relevant Circle CI commands:

image

 steps:
      - attach_workspace:
          at: .
      - aws-cli/setup
      - serverless-framework/setup

      - run:
          name: Deploy
          command: |
            export AWS_ACCESS_KEY_ID=$PROD_AWS_ACCESS_KEY_ID
            export AWS_SECRET_ACCESS_KEY=$PROD_AWS_SECRET_ACCESS_KEY
            export EGRESS_QUEUENAME_PREFIX=$PROD_EGRESS_QUEUENAME_PREFIX
            sls deploy --stage prod

Expected behavior

  • Should deploy as usual

Additional context

Running into timeout issues when downloading Serverless cli

Orb Version
1.0.1

Describe the bug
The following curl command to install the Serverless cli in the setup command occasionally results in a timeout:

curl -o- -L https://slss.io/install | bash

serverless

To Reproduce
Use the circleci/serverless-framework orb in a build, and run the setup command.

Expected behavior
The Serverless cli should be installed after running the setup command.

Additional context
This is an intermittent issue, but I noticed it happened around 10%~15% of the time.
Adding a retry to the curl command on timeout might address the issue.

Install serverless CLI command failing with "SSL certificate problem"

Orb Version
circleci/[email protected]

Describe the bug
When using orb version 1.0.1, when running the "Install Serverless CI" step within CircleCi, the job is failing with the following error:

curl: (60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.html

To Reproduce

Expected behavior

  • Job succeeds

Add parameter to specify serverless version

Is your feature request related to a problem? Please describe.
It may not be always appropriate to use the latest version of serverless.
Related to issue: #23

Describe the solution you'd like
It might be useful have an option to specify version of serverless framework. Orb should provide a param to use fixed version of serverless.

More example documentation for deploying Serverless

Is your feature request related to a problem? Please describe.

Currently, the executor for the setup command assumes a Python + Node environment setup.

this is totally reasonable since we want to install aws-cli and serverless CLI.

If we are using the same executor within a job to also run steps to command: serverless deploy, this would of course, only work in the examples of a Python Lambda, and possibly Node (if using the defaulted image).

This would not seem to work for other languages, like Ruby for example.

since packaging for Ruby dependencies would hit a wall in the same cimg/python:xxx executor.

Describe the solution you'd like

Initially, I was thinking if allowing more flexibility for the orb user to choose their executor / runtime in the setup command would be better since I can, for example, choose to use the lambci/lambci:build-ruby2.5 to serverless deploy (in my case, I needed to deploy to AWS and so LambCI's docker images are useful for serverless package).

However, I think it's not the issue of the setup command, but more about adding more verbose examples of how to deploy for serverless functions of different languages in a series of jobs (using different executors per job)?

Just my thoughts, and happy to help out with more examples (I'm trying to move some CircleCI configuration with deploying Ruby functions with Serverless to using this orb).

Describe alternatives you've considered

Additional context

2.0.0 orb is broken and should be flagged more obviously

Orb Version
2.0.0

Describe the bug
CircleCI started throwing this error even though we did not upgrade to 2.0.1. It fixed itself once we upgraded the orb, but there was no indication anywhere that the upgrade was a breaking change on previous orb versions.

bash: line 1: syntax error near unexpected token `newline'
bash: line 1: `<?xml version='1.0' encoding='utf-8' ?>'

To Reproduce
Have orb 2.0.0 as before and run the workflow to completion.

Expected behavior
It should not break, or people should be appropriately warned to upgrade.

Default executor is not using the expected node version

Orb Version: v1.0.1

Describe the bug

Serverless 2.69.0 is requiring Node 16 binaries.
The default executor version is using python 3.8-node which embeds node 14.

  • Deployment fails to upload the artifacts to S3

This is the error message you can expect

Resource handler returned message: "Uploaded file must be a non-empty zip (Service: Lambda, Status Code: 400, ...)"

To Reproduce

run deploy with default executor version

Expected behavior

deployment succeed

Additional context

N/A

Work around

Set the VERSION environment alongside the executor to set the SLS version to 2.68.x

Possible fix

  • Allow parameter to chose which version of SLS to install and then use curl -o- -L https://slss.io/install | VERSION=2.21.1 bash
  • Update default python image version

Examples in Documentation Fail to Deploy - Issue is "-v" prints version and exits

Orb Version
The version number of the orb

2.0.1

Describe the bug

Examples in documentation suggest running the following which actually returns the version number of serverless instead of actually deploying. From the serverless manual:

cjohnson@cjohnson10 cloudavail % serverless deploy --help
deploy                          Deploy a Serverless service
deploy function                 Deploy a single function from the service
deploy list                     List deployed version of your Serverless Service
deploy list functions           List all the deployed functions and their versions
--conceal                       Hide secrets from the output (e.g. API Gateway key values)
--package / -p                  Path of the deployment package
--force                         Forces a deployment to take place
--aws-s3-accelerate             Enables S3 Transfer Acceleration making uploading artifacts much faster.
--enforce-hash-update           Enforces new function version by overriding descriptions across all your functions. To be used only when migrating to new hashing algorithm.
--region / -r                   Region of the service
--aws-profile                   AWS profile to use with the command
--app                           Dashboard app
--org                           Dashboard org
--use-local-credentials         Rely on locally resolved AWS credentials instead of loading them from Dashboard provider settings (applies only to services integrated with Dashboard)
--config / -c                   Path to serverless config file
--stage / -s                    Stage of the service
--param                         Pass custom parameter values for "param" variable source (usage: --param="key=value")
--help / -h                     Show this message
--version / -v                  Show version info
--verbose                       Show verbose logs
--debug                         Namespace of debug logs to expose (use "*" to display all)

And the example from serverless-framework-orb documentation:

version: '2.1'
orbs:
  aws-cli: circleci/[email protected]
  serverless-framework: circleci/[email protected]
jobs:
  deploy:
    executor: serverless-framework/default
    steps:
      - checkout
      - aws-cli/setup
      - serverless-framework/setup
      - run:
          command: serverless deploy -v
          name: deploy

To Reproduce

NA

Expected behavior

I would expect the examples to work properly.

Additional context

AWS S3 buckets not being emptied before deletion

Orb Version

1.0.1

Describe the bug

When I package and deploy a project with the orb, once I try to do serverless remove --stage xyz for some reason I am given an error stating:

An error occurred: ServerlessDeploymentBucket - The bucket you tried to delete is not empty (Service: Amazon S3; Status Code: 409; Error Code: BucketNotEmpty; Request ID: ******; S3 Extended Request ID: ******; Proxy: null).

My previous experience with using sls deploy on the command line has shown/lead me to believe that there's no need for me to make any sort of s3 configurations and have to manually remove the contents of the bucket because it will be done automatically. I've attached how my config file is setup.

From what I can tell it has something to do with the package or deploy part. I used the command line and not the orb to package and deploy and then used remove and it worked fine.

To Reproduce

From what i can tell doing what I did in the images below should replicate the issue

Expected behavior

I expect for the deployment to be removed without any issue like on CLI when i use the serverless remove --stage action

Additional context

Screen Shot 2021-10-07 at 2 24 21 PM

Screen Shot 2021-10-07 at 2 24 08 PM

Screen Shot 2021-10-07 at 2 24 38 PM

SERVERLESS_ACCESS_KEY Should not be Required / Message Reports this as "Error"

Orb Version

2.0.1

Describe the bug

If the value SERVERLESS_ACCESS_KEY is not set the following error is thrown:

Error: The environment variable SERVERLESS_ACCESS_KEY is empty.
Please create your serverless dashboard access key and add it to this project as a project environment variable or via contexts.
https://serverless.com/framework/docs/dashboard/cicd/running-in-your-own-cicd#configure-environment-variables

To Reproduce

Create a CircleCI file similar to the following and run:

version: 2.1
orbs:
  aws-cli: circleci/[email protected]
  serverless-framework: circleci/[email protected]
jobs:
  deploy:
    executor: serverless-framework/default
    steps:
      - checkout
      - aws-cli/setup
      - serverless-framework/setup
workflows:
  deploy:
    jobs:
      - deploy

Expected behavior

I would expect a message more similar to the following:

INFO: The environment variable SERVERLESS_ACCESS_KEY is not set. This is required If you wish to utilize Serverless' dashboard functionality. You can create your serverless dashboard access key and add it as project environment variable or via a context.
https://serverless.com/framework/docs/dashboard/cicd/running-in-your-own-cicd#configure-environment-variables

Additional context

It has been my experience that a fair number of serverless users confuse the paid and free serverless offerings. My hope is that this change in language can help serverless users untangle this.

Skip or make the check of the provider credentials optional

Is your feature request related to a problem? Please describe.

This orb assumes, when the provider selected is AWS, the credentials are set in the default AWS environment variables AWS_ACCESS_KEY and AWS_SECRET_ACCESS_KEY. In our pipelines, we don't use those envs and the setup step fails.

Describe the solution you'd like
Split the setup command into separate commands:

  • install: install the serverless framework
  • (optional) auth: authenticate to serverless.com. Options app-name and org-name should be moved to this command.
  • (optional) verify-provider: verify the credentials for the specified provider. This command could have options. For example, if the provider is AWS we could specify the name of the env variables that have been used instead of the default ones or the AWS profile name to check.

Describe alternatives you've considered
The setup command could optionally skip the provider checks considering that the serverless framework has diverse ways to authorise an execution. For AWS alone we can:

  • use serverless config credentials --provider aws --key <key> --secret <secret>
  • pass the profile inline with --aws-profile <profile-name>
  • use the profile option of the provider configuration in the serverless.yml file.
  • using the AWS_PROFILE environment variable

Additional context
In general, adding more flexibility to this orb would make it far more usable.

serverless-pseudo-parameters not installed.

1.0.1
https://app.circleci.com/pipelines/github/sterling000/deckmasterweb-serverless/9/workflows/beffe32c-c4bd-44b5-beac-dc37e0f71655

trying to figure out how to get passed this plugin install, it works locally, i can run serverless deploy and it functions properly, it's listed in the serverless.yml, i ran the serverless install plugin --name serverless-pseudo-parameters command locally and it ran fine. I've tried adding it to my config for the orb but i keep getting this error and not sure what to do next.

To Reproduce

  1. Fork or Clone: https://github.com/sterling000/deckmasterweb-serverless
  2. enable circleci for your repo
  3. push a small change to trigger the pipeline.
  4. observe in the deploy step, it fails to install the serverless-pseudo-parameters plugin after it installs the serverless-cli

Expected behavior

I started this project following the tutorial here: https://www.serverless.com/learn/tutorial/user-creation/
Then i attempted to add circleci CI/CD for it, so I followed the instructions here for this orb.
I just put the latest version numbers into the orb config because the example had errors with x.y etc.
I am still on step #17 User Creation of the tutorial. Everything functions fine locally, just trying to have it autodeploy for me when i submit to github. (I'll lock down the repo later once things are configured).

Serverless framework orb installation in circleCI

1.0.1
The version number of the orb

Serverless framework orb installation error
Hi,
I am trying to integrate Serverless framework with circleCI. The installation works fine with using node as docker image and installing serverless framework. But, this is not working if I want to use the serverless framework orbs in circleCI to reduce build time. I get the following error (check attached file).

circleCIError2

Not being able to sls deploy with python

Orb Version
circleci/[email protected]

Describe the bug
Build is currently failing due to not being able to do: sls deploy

Error:
Error: `python3.7 -m pip help install` Exited with code 1
    at ChildProcess.<anonymous> (/home/circleci/project/node_modules/child-process-ext/spawn.js:38:8)
    at ChildProcess.emit (node:events:526:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1092:16)
    at Socket.<anonymous> (node:internal/child_process:451:11)
    at Socket.emit (node:events:526:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12)

Exited with code exit status 1
CircleCI received exit code 1

To Reproduce
Use orb and run - run: sls deploy

version: 2.1

orbs:
   aws-cli: circleci/[email protected]
   serverless-framework: circleci/[email protected]
   python: circleci/[email protected]
   
executors:
   python-version: 3.7-node

jobs:
   build_and_deploy:
     executor: serverless-framework/default
     steps:
       - checkout
       - aws-cli/setup
       - serverless-framework/setup
       - run: npm install -n serverless-plugin-git-variables 
       - run: npm install -n serverless-python-requirements 
       - run: sudo add-apt-repository ppa:deadsnakes/ppa
       - run: sudo apt update
       - run: sudo apt install python3.7
       - run: sudo apt install python3-pip
       - run: sls deploy
workflows:
  one_and_two:
    jobs:
      - build_and_deploy

Expected behavior

Being able to deploy with python.

Additional context

Not able to deploy since Serverless Compose release

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.