serverless-dotenv-plugin | Preload Environment Variables with Dotenv into Serverless | Serverless library

 by   neverendingqs JavaScript Version: 6.0.0 License: MIT

kandi X-RAY | serverless-dotenv-plugin Summary

kandi X-RAY | serverless-dotenv-plugin Summary

serverless-dotenv-plugin is a JavaScript library typically used in Serverless, Nodejs applications. serverless-dotenv-plugin has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can install using 'npm i serverless-dotenv-plugin' or download it from GitHub, npm.

Preload Environment Variables with Dotenv into Serverless
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              serverless-dotenv-plugin has a low active ecosystem.
              It has 329 star(s) with 51 fork(s). There are 4 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 4 open issues and 71 have been closed. On average issues are closed in 126 days. There are 6 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of serverless-dotenv-plugin is 6.0.0

            kandi-Quality Quality

              serverless-dotenv-plugin has 0 bugs and 0 code smells.

            kandi-Security Security

              serverless-dotenv-plugin has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              serverless-dotenv-plugin code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              serverless-dotenv-plugin is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              serverless-dotenv-plugin releases are not available. You will need to build from source code and install.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of serverless-dotenv-plugin
            Get all kandi verified functions for this library.

            serverless-dotenv-plugin Key Features

            No Key Features are available at this moment for serverless-dotenv-plugin.

            serverless-dotenv-plugin Examples and Code Snippets

            How to pass an environment variable to an AWS Lambda function using the Serverless framework?
            JavaScriptdot img1Lines of Code : 15dot img1License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            npm i -D serverless-dotenv-plugin
            
            service: myService
            plugins:
              - serverless-dotenv-plugin
            ...
            
            ...
            provider:
              name: aws
              runtime: nodejs6.10
              stage: ${env:STAGE}
              region: ${env:AWS_REGI

            Community Discussions

            QUESTION

            AWS Lambda Deployment - AccessDeniedException
            Asked 2021-Dec-20 at 07:03

            i have deployed a aws lambda app that uses dynamodb but when i run the lambda fuction i am getting following errors

            ...

            ANSWER

            Answered 2021-Dec-20 at 06:48

            The role assumed by your lambda function does not have required permissions to access the Dynamo Db table. To solve this, you need to attach the appropriate policy to your lambda function role.

            This page contains a policy that grants Read/Write access to your lambda function.

            Source https://stackoverflow.com/questions/70418163

            QUESTION

            Serverless Security Groups are required to be in the same VPC
            Asked 2021-Dec-15 at 16:51

            Currently I am facing an issue while trying to bind my serverless handlers to my vpc. My command to deploy is the following:

            ...

            ANSWER

            Answered 2021-Dec-15 at 16:51

            After some research we were able to connect our lambda to our vpc using serverless. The solution was: Stop using serverless-vpc-plugin.

            It turns out that serverless-vpc-plugin, automatically creates a AWS VPC, which is not what we were looking for. We already had our VPC created using terraform.

            From serverless-vpc-plugin documentation

            Automatically creates an AWS Virtual Private Cloud (VPC) using all available Availability Zones (AZ) in a region.

            In other words, serverless-vpc-plugin doesn't make sense when the target vpc already exists

            Source https://stackoverflow.com/questions/70339430

            QUESTION

            serverless-bundle Missing Dependencies
            Asked 2021-Nov-13 at 09:27

            I am failing to generate a bundle with serverless-bundle plugin.

            tsconfig.json

            ...

            ANSWER

            Answered 2021-Nov-13 at 09:27

            Looks like adding externals: all to custom.bundle in serverless.yml fixed the issue.

            Source https://stackoverflow.com/questions/69952799

            QUESTION

            Serverless WSGI not working in pipelines (works locally)
            Asked 2021-Apr-13 at 16:43

            I have the following steps configured in our bitbucket pipeline:

            ...

            ANSWER

            Answered 2021-Apr-13 at 16:43

            The answer was pretty mundane. Serverless 2.32+ introduced some change that broke the pipeline. Reverting to version 2.31.0 resolved the issue.

            Source https://stackoverflow.com/questions/67024428

            QUESTION

            Frequent timeout with app using Serverless Framework (AWS Lambda/Gateway), Express, Mongoose/MongoDB Atlas
            Asked 2020-Mar-10 at 00:02

            Trigger warning : Beginner question.

            I built an api using Express and Mongoose with a MongoDB Atlas DB.

            Most of the time, it works normally, but often I get timeout errors. This seems to happen very randomly and concerns all routes, etc... Precisely, I get :

            ...

            ANSWER

            Answered 2020-Mar-09 at 04:50

            Under your provider add timeout, maximum value of timeout in lambda is 900 seconds, place it according to your execution time like 30 seconds and see what happens

            Source https://stackoverflow.com/questions/60588274

            QUESTION

            Docker fails on npm install
            Asked 2020-Feb-10 at 12:43

            I'm new to Docker, and I've wanted try Dockerizing my node app.

            I've tried following the directions on nodejs.org, but I've been getting errors on npm install.

            Here is my Dockerfile:

            ...

            ANSWER

            Answered 2020-Feb-10 at 12:43

            I used to get this error due to low or intermittent internet bandwidth.

            Source https://stackoverflow.com/questions/60148199

            QUESTION

            Chrome Binary Not Found on AWS Lambda Using Serverless and chrome-aws-lambda Node package
            Asked 2020-Feb-09 at 21:28

            I have created a simple application that accepts a URL and converts it to a PDF. It stores the resultant PDF in an S3 bucket and returns the URL of the PDF. It uses Chrome (running headless) to convert the URL to a PDF. I used the serverless framework, AWS Lambda, and the chrome-aws-lambda npm package. When I execute this setup locally using serverless it all works great. I can use postman to make a request with a URL and it returns the URL of the resultant PDF. When I deploy this setup to AWS Lambda, it returns a 502 internal server error response. When I look at the AWS logs for my application I see the following:

            ...

            ANSWER

            Answered 2020-Feb-07 at 01:36

            serverless-bundle only includes the JS code that you use in your handler and strips everything else to minimize your bundle. That means the chrome binaries are excluded.

            To include those binaries, add the following to your serverless.yml:

            Source https://stackoverflow.com/questions/59987104

            QUESTION

            Passing secrets to lambda during deployment stage (CodePipeline) with Serverless?
            Asked 2020-Jan-16 at 01:47

            I have a CodePipeline with GitHub as a source, set up. I am trying to, without a success, pass a single secret parameter( in this case a Stripe secret key, currently defined in an .env file -> explaination down below ) to a specific Lambda during a Deployment stage in CodePipeline's execution.

            Deployment stage in my case is basically a CodeBuild project that runs the deployment.sh script:

            #! /bin/bash npm install -g serverless@1.60.4 serverless deploy --stage $env -v -r eu-central-1

            Explanation:

            I've tried doing this with serverless-dotenv-plugin, which serves the purpose when the deployment is done locally, but when it's done trough CodePipeline, it returns an error on lambda's execution, and with a reason:

            Since CodePipeline's Source is set to GitHub (.env file is not commited), whenever a change is commited to a git repository, CodePipeline's execution is triggered. By the time it reaches deployment stage, all node modules are installed (serverless-dotenv-plugin along with them) and when serverless deploy --stage $env -v -r eu-central-1 command executes serverless-dotenv-plugin will search for .env file in which my secret is stored, won't find it since there's no .env file because we are out of "local" scope, and when lambda requiring this secret triggers it will throw an error looking like this:

            So my question is, is it possible to do it with dotenv/serverless-dotenv-plugin, or should that approach be discarded? Should I maybe use SSM Parameter Store or Secrets Manager? If yes, could someone explain how? :)

            ...

            ANSWER

            Answered 2020-Jan-16 at 01:47

            So, upon further investigation of this topic I think I have the solution. SSM Parameter Store vs Secrets Manager is an entirely different topic, but for my purpose, SSM Paremeter Store is a choice that I chose to go along with for this problem. And basically it can be done in 2 ways.

            1. Use AWS Parameter Store

            Simply by adding a secret in your AWS Parameter Store Console, then referencing the value in your serverless.yml as a Lambda environement variable. Serverless Framework is able to fetch the value from your AWS Parameter Store account on deploy.

            provider: environement: stripeSecretKey: ${ssm:stripeSecretKey}

            Finally, you can reference it in your code just as before:

            const stripe = Stripe(process.env.stripeSecretKey);

            PROS: This can be used along with a local .env file for both local and remote usage while keeping your Lambda code the same, ie. process.env.stripeSecretKey

            CONS: Since the secrets are decrypted and then set as Lambda environment variables on deploy, if you go to your Lambda console, you'll be able to see the secret values in plain text. (Which kinda indicates some security issues)

            That brings me to the second way of doing this, which I find more secure and which I ultimately choose:

            2. Store in AWS Parameter Store, and decrypt at runtime To avoid exposing the secrets in plain text in your AWS Lambda Console, you can decrypt them at runtime instead. Here is how:

            • Add the secrets in your AWS Parameter Store Console just as in the above step.

            • Change your Lambda code to call the Parameter Store directly and decrypt the value at runtime:

              import stripePackage from 'stripe'; const aws = require('aws-sdk'); const ssm = new aws.SSM();

              const stripeSecretKey = ssm.getParameter( {Name: 'stripeSecretKey', WithDecryption: true} ).promise(); const stripe = stripePackage(stripeSecretKey.Parameter.Value);

            (Small tip: If your Lambda is defined as async function, make sure to use await keyword before ssm.getParameter(...).promise(); )

            PROS: Your secrets are not exposed in plain text at any point.

            CONS: Your Lambda code does get a bit more complicated, and there is an added latency since it needs to fetch the value from the store. (But considering it's only one parameter and it's free, it's a good trade-off I guess)

            For the conclusion I just want to mention that all this in order to work will require you to tweak your lambda's policy so it can access Systems Manager and your secret that's stored in Parameter Store, but that's easily inspected trough CloudWatch.

            Hopefully this helps someone out, happy coding :)

            Source https://stackoverflow.com/questions/59753617

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install serverless-dotenv-plugin

            First, install the plugin:.

            Support

            Because of the highly dependent nature of this plugin (i.e. thousands of developers depend on this to deploy their apps to production) I cannot introduce changes that are backwards incompatible. Any feature requests must first consider this as a blocker. If submitting a PR ensure that the change is developer opt-in only meaning it must guarantee that it will not affect existing workflows, it's only available with an opt-in setting. I appreciate your patience on this. Thanks.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i serverless-dotenv-plugin

          • CLONE
          • HTTPS

            https://github.com/neverendingqs/serverless-dotenv-plugin.git

          • CLI

            gh repo clone neverendingqs/serverless-dotenv-plugin

          • sshUrl

            git@github.com:neverendingqs/serverless-dotenv-plugin.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Serverless Libraries

            Try Top Libraries by neverendingqs

            netlify-express

            by neverendingqsJavaScript

            serverless-websocket-example

            by neverendingqsJavaScript

            serverless-dotenv-example

            by neverendingqsJavaScript

            openssl-self-signed-certificate

            by neverendingqsJavaScript

            oauth2-client-shell

            by neverendingqsJavaScript