Giter VIP home page Giter VIP logo

desktop's Introduction

Serverless Framework AWS Lambda AWS DynamoDB AWS API Gateway


Website  •  Documentation  •  X / Twitter  •  Community Slack  •  Forum


The Serverless Framework – Makes it easy to use AWS Lambda and other managed cloud services to build applications that auto-scale, cost nothing when idle, and overall result in radically low maintenance.

The Serverless Framework is a command-line tool with approachable YAML syntax to deploy both your code and cloud infrastructure needed to make tons of serverless application use-cases, like APIs, front-ends, data pipelines and scheduled tasks. It's a multi-language framework that supports Node.js, Typescript, Python, Go, Java, and more. It's also completely extensible via over 1,000 plugins which add more serverless use-cases and workflows to the Framework.

Actively maintained by Serverless Inc.


Serverless Framework - V.4


June 12th, 2024 – We've released Serverless Framework V.4 GA after testing the V.4 Alpha and Beta since early 2024. If you are upgrading to V.4, see our Upgrading to Serverless Framework V4 Documentation. If you need to access documentation for Serverless Framework V.3, you can find it here.

New Features In V.4

Here's a list of everything that's new in V.4, so far:

  • Native Typescript Support: You can now use .ts handlers in your AWS Lambda functions in serverless.yml and have them build automatically upon deploy. ESBuild is now included in the Framework which makes this possible. More info here.
  • New Dev Mode: Run serverless dev to have events from your live architecture routed to your local code, enabling you to make fast changes without deployment. More info here.
  • New Stages Property: Easily organize stage-specific config via stages and set default config to fallback to.
  • New Terraform & Vault Integrations: Pull state outputs from several Terraform state storage solutions, and secrets from Vault. Terraform Docs Vault Docs
  • Support Command: Send support requests to our team directly from the CLI, which auto-include contextual info which you can review before sending.
  • Debug Summary for AI: When you run into a bug, you can run "serverless support --ai" to generate a concise report detailing your last bug with all necessary context, optimized for pasting into AI tools such as ChatGPT.
  • New AWS Lambda Runtimes: "python3.12", "dotnet8", and "java21".
  • Advanced Logging Controls for AWS Lambda: Capture Logs in JSON, increased log granularity, and setting a custom Log Group. Here is the AWS article. Here is the YAML implementation
  • AWS SSO: Environment variables, especially ones set by AWS SSO, are prioritized. The Framework and Dashboard no longer interfere with these.
  • Automatic Updates: These happen by default now. Though, you will be able to control the level of updates you're open to.
  • Improved Onboarding & Set-Up: The serverless command has been re-written to be more helpful when setting up a new or existing project.
  • Updated Custom Resource Handlers: All custom resource handlers now use nodejs20.x.
  • Deprecation Of Non-AWS Providers: Deprecation of other cloud providers, in favor of handling this better in our upcoming Serverless Framework "Extensions".

Breaking Changes

We're seeking to avoid breaking changes for the "aws" Provider. However, there are a few large things that are changing to be aware of:

  • The V.4 License is changing. See the section below for more information on this.
  • Authentication is required within the CLI.
  • Non-AWS Providers have been deprecated. We will be introducing new ways in V.4 to use other cloud infrastructure vendors.

If you stumble upon additional breaking changes, please create an issue. To learn more about what's different and potential breaking changes, please see our Upgrading to Serverless Framework V4 Documentation.

License Changes in V.4

Please note, the structure and licensing of the V.4 repository differ from the V.4 npm module. The npm module contains some proprietary licensed software, as V.4 transitions to a common SaaS product, as previously announced. The original Serverless Framework source code and more will continue to remain MIT license software, the repository will soon be restructured to clearly distinguish between proprietary and open-source components.


Contents


Features

  • Build More, Manage Less: Innovate faster by spending less time on infrastructure management.
  • Maximum Versatility: Tackle diverse serverless use cases, from APIs and scheduled tasks to web sockets and data pipelines.
  • Automated Deployment: Streamline development with code and infrastructure deployment handled together.
  • Local Development: Route events from AWS to your local AWS Lambda code to develop faster without having to deploy every change.
  • Ease of Use: Deploy complex applications without deep cloud infrastructure expertise, thanks to simple YAML configuration.
  • Language Agnostic: Build in your preferred language – Node.js, Python, Java, Go, C#, Ruby, Swift, Kotlin, PHP, Scala, or F#.
  • Complete Lifecycle Management: Develop, deploy, monitor, update, and troubleshoot serverless applications with ease.
  • Scalable Organization: Structure large projects and teams efficiently by breaking down large apps into Services to work on individually or together via Serverless Compose.
  • Effortless Environments: Seamlessly manage development, staging, and production environments.
  • Customization Ready: Extend and modify the Framework's functionality with a rich plugin ecosystem.
  • Vibrant Community: Get support and connect with a passionate community of Serverless developers.

Quick Start

Here's how to install the Serverless Framework, set up a project and deploy it to Amazon Web Services on serverless infrastructure like AWS Lambda, AWS DynamoDB, AWS S3 and more.


Install the Serverless Framework via NPM

First, you must have the Node.js runtime installed, then you can install the Serverless Framework via NPM.

Open your CLI and run the command below to install the Serverless Framework globally.

npm i serverless -g

Run serverless to verify your installation is working, and show the current version.


Update Serverless Framework

As of version 4, the Serverless Framework automatically updates itself and performs a check to do so every 24 hours.

You can force an update by running this command:

serverless update

Or, you can set this environment variable:

SERVERLESS_FRAMEWORK_FORCE_UPDATE=true

The serverless Command

The Serverless Framework ships with a serverless command that walks you through getting a project created and deployed onto AWS. It helps with downloading a Template, setting up AWS Credentials, setting up the Serverless Framework Dashboard, and more, while explaining each concept along the way.

This guide will also walk you through getting started with the Serverless Framework, but please note, simply typing the serverless command may be the superior experience.

serverless

Create A Service

The primary concept for a project in the Serverless Framework is known as a "Service", and its declared by a serverless.yml file, which contains simplified syntax for deploying cloud infrastructure, such as AWS Lambda functions, infrastructure that triggers those functions with events, and additional infrastructure your AWS Lambda functions may need for various use-cases (e.g. AWS DynamoDB database tables, AWS S3 storage buckets, AWS API Gateways for recieving HTTP requests and forwarding them to AWS Lambda).

A Service can either be an entire application, logic for a specific domain (e.g. "blog", "users", "products"), or a microservice handling one task. You decide how to organize your project. Generally, we recommend starting with a monolithic approach to everything to reduce complexity, until breaking up logic is absolutely necessary.

To create and fully set up a Serverless Framework Service, use the serverless command, which offers an interactive set-up workflow.

serverless

This will show you several Templates. Choose one that fits the language and use-case you want.

Serverless ϟ Framework
Welcome to Serverless Framework V.4

Create a new project by selecting a Template to generate scaffolding for a specific use-case.

? Select A Template: …
❯ AWS / Node.js / Starter
  AWS / Node.js / HTTP API
  AWS / Node.js / Scheduled Task
  AWS / Node.js / SQS Worker
  AWS / Node.js / Express API
  AWS / Node.js / Express API with DynamoDB
  AWS / Python / Starter
  AWS / Python / HTTP API
  AWS / Python / Scheduled Task
  AWS / Python / SQS Worker
  AWS / Python / Flask API
  AWS / Python / Flask API with DynamoDB
  (Scroll for more)

After selecting a Service Template, its files will be downloaded and you will have the opportunity to give your Service a name.

? Name Your Service: ›

Please use only lowercase letters, numbers and hyphens. Also, keep Service names short, since they are added into the name of each cloud resource the Serverless Framework creates, and some cloud resources have character length restrictions in their names.

Learn more about Services and more in the Core Concepts documentation.


Signing In

As of Serverless Framework V.4, if you are using the serverless command to set up a Service, it will eventually ask you to log in.

If you need to log in outside of that, run serverless login.

Logging in will redirect you to the Serverless Framework Dashboard within your browser. After registering or logging in, go back to your CLI and you will be signed in.

Please note, you can get up and running with the Serverless Framework CLI and Dashboard for free, and the CLI will always be free for small orgs and indiehackers. For more information on pricing, check out our pricing page.


Creating An App

The "App" concept is a parent container for one or many "Services" which you can optionally set via the app property in your serverless.yml. Setting an app also enables Serverless Framework Dashboard features for that Service, like tracking your Services and their deployments in Serverless Framework Dashboard, enabling sharing outputs between them, sharing secrets between them, and enabling metrics, traces and logs.

If you are using the serverless onboarding command, it will help you set up an app and add it to your Service. You can use the serverless command to create an App on an existing Service as well, or create an App in the Dashboard.

❯ Create A New App
  ecommerce
  blog
  acmeinc
  Skip Adding An App

The app can also be set manually in serverless.yml via the app property:

service: my-service
app: my-app

If you don't want to use the Serverless Framework Dashboard's features, simply don't add an app property. Apps are not required.


Setting Up AWS Credentials

To deploy cloud infrastructure to AWS, you must give the Serverless Framework access to your AWS credentials.

Running the Serverless Framework's serverless command in a new or existing Service will help identify if AWS credentials have been set correctly or if they are expired, or help you set them up from scratch.

No valid AWS Credentials were found in your environment variables or on your machine. Serverless Framework needs these to access your AWS account and deploy resources to it. Choose an option below to set up AWS Credentials.

❯ Create AWS IAM Role (Easy & Recommended)
  Save AWS Credentials in a Local Profile
  Skip & Set Later (AWS SSO, ENV Vars)

We recommend creating an AWS IAM Role that's stored in the Serverless Framework Dashboard. We'll be supporting a lot of Provider Credentials in the near future, and the Dashboard is a great place to keep these centralized across your team, helping you stay organized, and securely eliminating the need to keep credentials on the machines of your teammates.

If you are using AWS SSO, we recommend simply pasting your temporary SSO credentials within the terminal as environment variables.

To learn more about setting up your AWS Credentials, read this guide.


Deploy A Service

After you've used the serverless command to set up everything, it's time to deploy your Service to AWS.

Make sure your terminal session is within the directory that contains your serverless.yml file. If you just created a Service, don't forget to cd into it.

cd [your-new-service-name]

Deploying will create/update cloud infrastructure and code on AWS, all at the same time.

Run the deploy command:

serverless deploy

More details on deploying can be found here.


Developing

Many Serverless Framework and serverless developers generally choose to develop on the cloud, since it matches reality (i.e. your production environment), and emulating Lambda and other infrastructure dependencies locally can be complex.

In Serverless Framework V.4, we've created a hybrid approach to development, to help developers develop rapidly with the accuracy of the real cloud environment. This is the new dev command:

serverless dev

When you run this command, the following happens...

An AWS Cloudformation deployment will happen to slightly modify all of the AWS Lambda functions within your Service so that they include a lightweight wrapper.

Once this AWS Cloudformation deployment has completed, your live AWS Lambda functions within your Service will still be able to receive events and be invoked within AWS.

However, the events will be securely and instantly proxied down to your machine, and the code on your machine which will be run, rather than the code within your live AWS Lambda functions.

This allows you to make changes to your code, without having to deploy or recreate every aspect of your architecture locally, allowing you to develop rapidly.

Logs from your local code will also be shown within your terminal dev session.

Once your code has finished, the response from your local code will be forwarded back up to your live AWS Lambda functions, and they will return the response—just like a normal AWS Lambda function in the cloud would.

Please note, dev is only designed for development or personal stages/environments and should not be run in production or any stage where a high volume of events are being processed.

Once you are finished with your dev session, you MUST re-deploy, using serverless deploy to push your recent local changes back to your live AWS Lambda functions—or your AWS Lambda functions will fail(!)

More details on dev mode can be found here.


Invoking

To invoke your AWS Lambda function on the cloud, you can find URLs for your functions w/ API endpoints in the serverless deploy output, or retrieve them via serverless info. If your functions do not have API endpoints, you can use the invoke command, like this:

sls invoke -f hello

# Invoke and display logs:
serverless invoke -f hello --log

More details on the invoke command can be found here.


Deploy Functions

To deploy code changes quickly, you can skip the serverless deploy command which is much slower since it triggers a full AWS CloudFormation update, and deploy only code and configuration changes to a specific AWS Lambda function.

To deploy code and configuration changes to individual AWS Lambda functions in seconds, use the deploy function command, with -f [function name in serverless.yml] set to the function you want to deploy.

serverless deploy function -f my-api

More details on the deploy function command can be found here.


Streaming Logs

You can use Serverless Framework to stream logs from AWS Cloudwatch directly to your terminal. Use the sls logs command in a separate terminal window:

sls logs -f [Function name in serverless.yml] -t

Target a specific function via the -f option and enable tailing (i.e. streaming) via the -t option.


Full Local Development

Many Serverless Framework users choose to emulate their entire serverless architecture locally. Please note, emulating AWS Lambda and other cloud services is never accurate and the process can be complex, especially as your project and teammates grow. As of V.4, we highly recommend using the new dev mode with personal stages.

If you do choose to develop locally, we recommend the following workflow...

Use the invoke local command to invoke your function locally:

sls invoke local -f my-api

You can also pass data to this local invocation via a variety of ways. Here's one of them:

sls invoke local --function functionName --data '{"a":"bar"}'

More details on the invoke local command can be found here

Serverless Framework also has a great plugin that allows you to run a server locally and emulate AWS API Gateway. This is the serverless-offline command.

More details on the serverless-offline plugins command can be found here.


Use Plugins

A big benefit of Serverless Framework is within its Plugin ecosystem.

Plugins extend or overwrite the Serverless Framework, giving it new use-cases or capabilites, and there are hundreds of them.

Some of the most common Plugins are:


Remove Your Service

If you want to delete your service, run remove. This will delete all the AWS resources created by your project and ensure that you don't incur any unexpected charges. It will also remove the service from Serverless Dashboard.

serverless remove

More details on the remove command can be found here.


Composing Services

Serverless Framework Compose allows you to work with multiple Serverless Framework Services at once, and do the following...

  • Deploy multiple services in parallel
  • Deploy services in a specific order
  • Share outputs from one service to another
  • Run commands across multiple services

Here is what a project structure might look like:

my-app/
  service-a/
    src/
      ...
    serverless.yml
  service-b/
    src/
      ...
    serverless.yml

Using Serverless Framework Compose requires a serverless-compose.yml file. In it, you specify which Services you wish to deploy. You can also share data from one Service to another, which also creates a deployment order.

# serverless-compose.yml

services:
  service-a:
    path: service-a

  service-b:
    path: service-b
    params:
      queueUrl: ${service-a.queueUrl}

Currently, outputs to be inherited by another Service must be AWS Cloudformation Outputs.

# service-a/serverless.yml

# ...

resources:
  Resources:
    MyQueue:
      Type: AWS::SQS::Queue
      # ...
  Outputs:
    queueUrl:
      Value: !Ref MyQueue

The value will be passed to service-b as a parameter named queueUrl. Parameters can be referenced in Serverless Framework configuration via the ${param:xxx} syntax:

# service-b/serverless.yml

provider:
  ...
  environment:
    # Here we inject the queue URL as a Lambda environment variable
    SERVICE_A_QUEUE_URL: ${param:queueUrl}

More details on Serverless Framework Compose can be found here.


Support Command

In Serverless Framework V.4, we've introduced the serverless support command, a standout feature that lets you generate issue reports, or directly connect with our support team. It automatically includes relevant context and omits sensitive details like secrets and account information, which you can check before submission. This streamlined process ensures your issues are quickly and securely addressed.

To use this feature, after an error or any command, run:

sls support

After each command, whether it succeeded or not, the context is saved within your current working directory in the .serverless folder.

To open a new support ticket, run the sls support command and select Get priority support.... Optionally you'll be able to review and edit the generated report. Opening support tickets is only available to users who sign up for a Subscription.

You can also generate reports without submitting a new support ticket. This is useful for sharing context with others, opening Github issues, or using it with an AI prompt like ChatGPT. To do this, run the sls support command and select Create a summary report..., or Create a comprehensive report... You can skip the prompt by running sls support --summary or sls support --all. This is especially useful for capturing the report into the clipboard (e.g. sls support --summary | pbcopy).


Remove Your Service

If you want to delete your service, run remove. This will delete all the AWS resources created by your project and ensure that you don't incur any unexpected charges. It will also remove the service from Serverless Dashboard.

sls remove

More details on the remove command can be found here.


What's Next

Here are some helpful resources for continuing with the Serverless Framework:


Community

desktop's People

Contributors

astuyve avatar austencollins avatar stevewillard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

desktop's Issues

Functions not instrumented

In my personal org, a console log statement says functions are instrumented, but they are not, and network requests to call the back-end to perform the instrumentation do not appear to happen.

In @stevewillard's org, the network request happens to instrument functions.

Using saved HTTP requests, Events or Queries is broken

As of v0.0.107 I'm unable to use saved HTTP requests, Events, or Queries. When I click on a saved item, or when I save a new item, the view switches to a stage that does not exist (though in this case, the stage used to exist), and the view is blank.

It could be related to the recent change where stage names and regions were combined into the stage name. However, it also feels like it could be related to the way this stored data is structured.

Screen Shot 2021-01-07 at 6 47 21 PM

Apps don't show up without connecting an AWS account

Hello,

I have several apps across multiple organizations that i've deployed with app.serverless.com.

When I login to the new desktop app, I see my organization list in the bottom right, but none of my apps are listed.

My apps are deployed using IAM User accounts created by my client's root accounts, so I would prefer to not have to login with new credentials than the ones i've already used.

I do my deploys from command line so far with access keys, I would prefer to enter them into the desktop app but have the lsit of my apps loaded on first launch and when i switch organizations.

Unable to login with Google with 2FA

I'm not able to login using Google with 2FA. I usually have the option for Security key, Authenticator app and Google prompts but none of those seem to be allowed.

Windows 10 Home Version 10.0.21337 Build 21337

image

Sync errors not being shown to user

When opening a view, and the sync process fails, no error is shown to the user. Instead, the view is simply blank.

Here is an example where a resource was not found because it was deleted manually, even though it is listed in a CloudFormation stack.

Screen Shot 2021-02-09 at 12 07 45 PM

Broke some IAM permissions?

While installing Desktop it had me approve a new cloudstack thingy and now my CircleCI jobs fail when deploying functions:

An error occurred: CustomDashresourceDashapigwDashcwDashroleLambdaFunction - AccessDenied. User doesn't have permission to call iam:GetRole.

This seems not good :(

Missing Connection Provider breaks Desktop

In the Serverless Dashboard, I deleted the Provider used by a Connection within Serverless Desktop. Now, I'm unable to fix my Connection, and all of the Services using that Provider/Connection are broken.

Screen Shot 2021-02-15 at 6 15 51 AM

Screen Shot 2021-02-15 at 6 16 04 AM

Being able to edit an existing Connection and add a new Provider to it will resolve this problem. Until then, Desktop is permanently broken for users who experience this.

Not working...

Hello.

I don't understand, how to log to our AWS account and use the application. I have created some account for your application, not working. I have created account at GitHub, not working. And finally I cannot login via Google account... There is no menu item to sign to AWS etc. etc. It's very strange and confusing...

I would like to have some better IDE than AWS web application, because of it is very unclear etc., but your desktop application doesn't work at all...

Sidebar not visible when app is loaded

On a 13" macbook, when installing and starting the Desktop app for the first time, the sidebar showing apps is not visible despite the app taking up most of the desktop space. There is also no button to toggle the sidebar. This makes it seem as if there is no functionality, especially for new users.

Screen Shot 2021-03-08 at 7 18 44 AM

Strange UI behavior when removing a Connection

When removing a Connection that contained ~50 Serverless Framework Services, the Services list on the left gradually disappears as expected.

However, once all Services on the left are gone, the removing process continues and single Services randomly show up in the left column for about 2 seconds, then disappear again. This happened for about 15 Services.

List is gone...
Screen Shot 2021-01-27 at 10 53 50 PM

Suddenly individual Services show up again...
Screen Shot 2021-01-27 at 10 53 53 PM

Streaming Logs Don't Work After Idling

When not using a test view for multiple hours (e.g. attending meetings, working on other things), the websocket connection times out, and no logs are received. However, the app still says streaming logs are enabled. The Desktop app needs to restart the websocket connection.

Invoke View: Irregular Log behavior

I'm seeing some irregular log behavior in the Invoke View. Here is what's working successfully, and what's not:

  • Navigating To HTTP Invoke From Home Screen: Requests showed with logs, no delay.
  • Using Another App For 30 Seconds & Returning To HTTP Invoke View: Requests showed with logs, no delay.
  • Using Another App For 5 Minutes & Returning To HTTP Invoke View: Requests showed with logs, no delay.
  • Switching To Another View & Returning To HTTP Invoke View: First requests did not show logs, but subsequent requests did, no delay. Was able to reproduce this multiple times.

Screen Shot 2021-01-04 at 9 37 05 PM

  • Switching From HTTP Invoke View to Function Invoke View: First requests did not show logs, but subsequent requests did, no delay. Was able to reproduce this multiple times.

Screen Shot 2021-01-04 at 9 39 58 PM

  • Switching Between HTTP Invoke View and Function Invoke View Quickly: I switched back and forth between these multiple times within a couple of seconds. This seemed to break everything. No logs.

Screen Shot 2021-01-04 at 9 41 47 PM

  • API Gateway HTTP Invoke View: No logs showed up.

Screen Shot 2021-01-04 at 9 40 28 PM

Memory Leak on Windows 10

I installed the beta last week and I've been installing each update as they come so I'm up to date.

I logged in with my account and have switched organizations, but due to another bug #20 I haven't used the new app much.

I closed out of the app, but apparently the process was still running in the background, and almost 24 hours later my operating system started grinding to a halt, and when I tried to switch tabs some of my other apps crashed saying my laptop was out of memory (I usually run around 12GB usage out of 16GB).

I checked task manager and the Serverless app had bloated to almost 4GB of ram without even being open or used. I killed the process and my machine returned to normal.

Sync seems to not work with a new Provider

When I delete a Provider and recreated it via the onboarding flow, then run the sync process, the sync process begins but the status from the sync is always inactive meaning it was never started. This screen then hangs indefinitely.

Please note that I have already created Providers, synced with them, removed everything, and deleted Providers multiple times before this. It is not the case that my account replicates a new user exactly.

HTTP Invoke: Odd Error Formatting

What is the text in red that says "Data not included in response body"? Is this an error? If so, why is it not formatted like the other errors? Could we format all errors the same way so they can more easily be understood by users?

Screen Shot 2021-01-04 at 9 37 05 PM

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.