Code Monkey home page Code Monkey logo

balassy / aws-lambda-typescript Goto Github PK

View Code? Open in Web Editor NEW
266.0 13.0 50.0 1.57 MB

This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, publish it through API Gateway to a custom domain registered on Route53, and document it with Swagger.

License: MIT License

TypeScript 100.00%
aws aws-lambda typescript mocha tslint serverless serverless-framework aws-cloudformation aws-apigateway swagger

aws-lambda-typescript's Introduction

AWS Lambda in TypeScript

This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, and publish it through API Gateway.

IMPORTANT! Since I am not working on any AWS Lambda project at the moment I temporarily suspended the maintenance of this project, because I cannot closely follow the evolution of the platform and validate that this project is still working and useful. I recently turned off Greenkeeper, because it often submitted broken PRs that failed on CI, and checking and fixing those took more time than I can spend on this project. I still believe that this sample has value and I am planning to update it for my next Lambda project. Thanks for understanding.

serverless Linux Build Status Windows Build status Coverage Status GitHub license GitHub issues Swagger Validator

Known Vulnerabilities Dependencies DevDependencies codebeat badge CII Best Practices

Features

  • Full TypeScript codebase with strict type annotation - get as many compile time errors as possible.
  • Deployment to AWS from the command line with Serverless - just run an npm script.
  • Publishing to your custom Route53 domain name - for API URLs that live forever.
  • Automated builds and CI with Travis CI on Linux and AppVeyor on Windows - get early feedback for every change.
  • Offline execution - call your endpoints without deploying them to AWS.
  • Minimal IAM policy to follow the principle of least privilege - because with great power comes great responsibility.
  • Code analysis with TSLint and Codebeat - avoid dumb coding mistakes.
  • Unit testing with Mocha, mocking with ts-mockito - be free to change your implementation.
  • Test coverage report with Istanbul and Coveralls - so you know your weak spots.
  • Integration testing after release - to verify your deployment.
  • Generated Swagger documentation for the endpoints, which works well with SwaggerHub - the expected description of your API.
  • Multiple layers in the code to separate concerns and independently test them - avoid monolith and complexity.
  • Health check endpoints - to quickly test your service.
  • Dependency checks with David and Snyk - because the majority of your app is not your code.
  • EditorConfig settings - for consistent coding styles between different editors.
  • Sample CRUD implementation (in progress) - to see it all in action.
  • Follows Linux Foundation Core Infrastructure Initiative Best Practices - for the open source community.

For updates, please check the CHANGELOG.

Setup

  1. Install Node.js.

  2. Install the Serverless Application Framework as a globally available package:

npm install serverless -g

Verify that Serverless was installed correctly:

serverless -v
  1. Setup AWS credentials:
  • Create a new IAM Policy in AWS using the aws-setup/aws-policy.json file. Note that the file contains placeholders for your <account_no>, <region>, <service_name>, and <your_deployment_bucket>. You can replace all those Resource ARNs with *, if you intentionally don't want to follow the Principle of Least Privilege, but want to avoid permission issues. (If you prefer minimal permissions, just like me, you may want to follow Issue 1439: Narrowing the Serverless IAM Deployment Policy. )

  • Create a new IAM User for Programmatic Access only, assign the previously created policy to it, and get the Access Key ID and the Secret Access Key of the user.

  • Save the credentials to the ~/.aws/credentials file:

serverless config credentials --provider aws --key YOUR_ACCESS_KEY --secret YOUR_SECRET_KEY

Unfortunately on Windows you will need an Administrator user to run the Serverless CLI.

You can read more about setting up AWS Credentials on the AWS - Credentials page of the Serverless Guide.

  1. Clone this repository.

  2. Install the dependencies:

npm install
  1. Customize the name of your service by changing the following line in the serverless.yml file:
service: serverless-sample
  1. Customize the name of your domain by changing the following lines in the serverless.yml file:
custom:
  customDomain:
    domainName: serverless-sample.balassy.me
    certificateName: serverless-sample.balassy.me

NOTE: You must have the certificate created in AWS Certificate Manager before executing this command. According to AWS to use an ACM certificate with API Gateway, you must request or import the certificate in the US East (N. Virginia) region.

If you don't want to publish your API to a custom domain, remove the serverless-domain-manager from the plugins section, and the customDomains entry from the custom section of the serverless.yml file.

What you can find in the code

Example CRUD endpoints

This project shows example Lambda function implementations with the following layers (see the src/cities folder):

  • Handler: The handler is the endpoint that is called by AWS when it executes your Lambda. See cities.ts.
  • Controller: The controller is responsible for transforming any operation result to an HTTP response. See cities.controller.ts.
  • Service: The service is responsible for implementing the business logic, and provide the operation result. See cities.service.ts.
  • Repository: The repository is responsible for providing the data for the service. See cities.repository.ts.

All layers have unit tests with mocking the underlying layers.

Additional terms:

  • Response: The HTTP output for an endpoint call. It includes the HTTP status code, the response headers and the response body. The controller is responsible for building the response, using the ResponseBuilder helper class.
  • Result: The outcome of the service call. It can be a success result or an error result.

To understand the code, open src/cities/cities.ts, find the getCity function and follow the call chain.

Swagger export

The src/swagger folder contains the /swagger.json endpoint which exports the documentation of the API in Swagger format. Call the endpoint after deploying your API and paste the response JSON into the Swagger Editor to display it in a friendly way.

You can also reference the swagger.json URL when you publish your documentation via SwaggerHub, as you can see on the SwaggerHub page of this sample: https://app.swaggerhub.com/apis/balassy/serverless-sample.

Health check endpoints

The /health/check and the /health/check/detailed endpoints in the src/health folder are provided to run quick checks on your API after deployment.

Developer tasks

Frequently used npm scripts:

Script name Description
analyse Runs all code analysis tools, including linters and unit tests.
deploy Runs all analysis tools, creates the deployment package, installs it on AWS and finally runs the integration tests.
start Runs the service locally, so you can call your API endpoints on http://localhost.

Additional useful npm scripts:

Script name Description
build Runs all pre-deploy analysis and creates the deployment package, but does not install it onto AWS.
clean Removes all tool-generated files and folders (build output, coverage report etc.). Automatically runs as part of other scripts.
deploy:init Creates the domain in Route53. Required to manually execute once.
lint Runs the static code analyzers. Automatically runs before deployment.
test Runs the unit tests. Automatically runs before deployment.
test:integration Runs the integration tests. Automatically runs after deployment.

Test the service locally

To invoke the Lambda function locally, run: This command requires Administrator privileges on Windows!

serverless invoke local --function getCity

To run the service locally, run: This command requires Administrator privileges on Windows!

npm start

This command will not terminate, but will keep running a webserver that you can use to locally test your service. Verify that the service runs perfectly by opening the http://localhost:3000 URL in your browser. The console window will log your requests.

You can modify your code after running this command, Serverless will automatically recognize the changes and recompile your code.

Deploy to AWS

To create a custom domain for your service in AWS, run this command once: This command requires Administrator privileges on Windows!

npm run deploy:init

According to AWS, after this command it may take up to 40 minutes to initialize the domain with a CloudFront distribution. In practice it usually takes about 10 minutes.

To deploy the service to AWS, run: This command requires Administrator privileges on Windows!

serverless deploy

or you can use the NPM script alias, which is recommended, because it runs the analysers (linter + tests) before deployment, and integration tests after deployment:

npm run deploy

Verify that the deployment is completed successfully by opening the URL displayed in your console window in your browser. To see all resources created in AWS navigate to CloudFormation in the AWS Console and look for the stack named with the name of your service you specified in Step 6.

To download the Swagger description of your service, open the following URL in your browser:

https://<your_custom_domain_name>/api/swagger.json

Note that this endpoint always downloads the Swagger documentation from the live, published API, even if the code is running locally!

If you don't want to deploy your code, just want to peek into the deployment package, you can run:

npm run build

This command is not only an alias to serverless package, but also runs all analyzers that the deploy process also runs.

Run linter

To check your codebase with TSLint, run:

npm run lint

The linter automatically checks your code before deployment, so you don't need to run it manually.

Run unit tests

To check your code with unit tests, run:

npm test

The unit tests are automatically running before deployment, so you don't need to run them manually.

Run integration tests

To verify that your deployment completed successfully, run:

npm run test:integration

The integration tests are automatically running after deployment, so you don't need to run them manually.

View the documentation

To view the generated Swagger documentation, deploy your API or start it locally, and then call the /swagger.json endpoint.

Problems?

EPERM: operation not permitted, symlink 'C:\Git\aws-lambda-typescript\node_modules' -> 'C:\Git\aws-lambda-typescript\.build\node_modules'

On Windows you need Administrator privileges to run serverless commands (see Issue 23).

Got feedback?

Your feedback is more than welcome, please send your suggestions, feature requests or bug reports as Github issues.

Contributing guidelines

Contributions of all kinds are welcome, please feel free to send Pull Requests. As they are requirements of successful build all linters and tests MUST pass, and also please make sure you have a reasonable code coverage for new code.

Thanks for your help in making this project better!

Read more

Acknowledments

Thanks to Shovon Hasan for his article on Deploying a TypeScript + Node AWS Lambda Function with Serverless.

About the author

This project was created by György Balássy.

aws-lambda-typescript's People

Contributors

balassy avatar greenkeeper[bot] avatar greenkeeperio-bot 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

aws-lambda-typescript's Issues

Serverless deploy with Sequelize Typescript

Hello,

I build my project using the same farmwork and implement sequelize typescript for the data operation.

It's working fine with serverless offline.

but not working after deploy.

Thanks,

An in-range update of serverless-plugin-typescript is breaking the build 🚨

The devDependency serverless-plugin-typescript was updated from 1.1.5 to 1.1.6.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

serverless-plugin-typescript is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Release Notes for v1.1.6

1.1.6 (2019-04-06)

Bug Fixes

Commits

The new version differs by 15 commits.

  • b8f12d6 fix(pencil): Add third parameter to fs.symlinkSync
  • caf50c0 Update git repo url location
  • 6240708 fix(provoke-release)
  • 9142ce6 Fix: provoke release
  • 2045258 Merge pull request #135 from prisma/update-dependencies
  • 66fc9c5 Replace node 9 with node 10
  • 03f19a6 Upgrade dependencies and make TypeScript a peer dependency
  • b2100e8 Merge pull request #134 from prisma/add-mit-license
  • 267eb80 Add MIT license, resolves #123
  • 55aa82b chore(deps): update dependency ts-jest to v22.0.1
  • 73f2cde chore(deps): update dependency @types/jest to v22.0.1
  • 091a189 Merge pull request #69 from graphcool/renovate/serverless-plugin-typescript-1.x
  • 17ed089 Merge pull request #67 from graphcool/renovate/types-fs-extra-5.x
  • eb8d4c6 chore(deps): update dependency @types/fs-extra to v5.0.0
  • 71bba40 chore(deps): update dependency serverless-plugin-typescript to v1.1.5

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of serverless-domain-manager is breaking the build 🚨

The devDependency serverless-domain-manager was updated from 2.6.10 to 2.6.11.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

serverless-domain-manager is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build passed (Details).
  • continuous-integration/appveyor/branch: AppVeyor build succeeded (Details).
  • coverage/coveralls: First build on greenkeeper/serverless-domain-manager-2.6.11 at 100.0% (Details).
  • security/snyk - package.json (balassy): No new issues (Details).
  • continuous-integration/appveyor/pr: AppVeyor was unable to build non-mergeable pull request

Commits

The new version differs by 3 commits.

  • a6d8ea2 Merge pull request #178 from attila/fix/custom-restapiid
  • b439014 Step version
  • 4e6e8f3 Use existing API id only when defined

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/aws-lambda is breaking the build 🚨

The devDependency @types/aws-lambda was updated from 8.10.11 to 8.10.12.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/aws-lambda is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: Waiting for AppVeyor build to complete (Details).
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of aws-sdk is breaking the build 🚨

The devDependency aws-sdk was updated from 2.323.0 to 2.324.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

aws-sdk is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Release Notes for Release v2.324.0

See changelog for more information.

Commits

The new version differs by 1 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 10.12.11 to 10.12.12.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/request is breaking the build 🚨

The devDependency @types/request was updated from 2.48.1 to 2.48.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/request is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of aws-sdk is breaking the build 🚨

Version 2.312.0 of aws-sdk was just published.

Branch Build failing 🚨
Dependency aws-sdk
Current Version 2.311.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

aws-sdk is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes Release v2.312.0

See changelog for more information.

Commits

The new version differs by 6 commits.

  • 4ed5104 Updates SDK to v2.312.0
  • 3839328 Create no-response.yml
  • 59f1eb0 remove stalebot
  • 23701ac enable stale bot
  • f5a3482 update typings for credentialsProviderChain & httpOptions (#2240)
  • 167bc31 retry request for Batch TooManyRequestsException (#2246)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of chance is breaking the build 🚨

The devDependency chance was updated from 1.0.17 to 1.0.18.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

chance is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Commits

The new version differs by 3 commits.

  • d16e93c Bump version to 1.0.18 to resolve #396
  • b7f4c2b Replaced es6 arrow function with function (#395)
  • 98964cc 😞 I committed sloppy code (#394)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 10.12.7 to 10.12.8.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of mocha is breaking the build 🚨

The devDependency mocha was updated from 6.1.3 to 6.1.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v6.1.4

6.1.4 / 2019-04-18

🔒 Security Fixes

Commits

The new version differs by 3 commits.

  • 31c019e Release v6.1.4
  • c3d241e update CHANGELOG.md for v6.1.4 [ci skip]
  • 0d9d4a3 Update js-yaml from 3.13.0 to 3.13.1 (#3877)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 12.7.0 to 12.7.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build succeeded (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).
  • coverage/coveralls: First build on greenkeeper/@types/node-12.7.1 at 100.0% (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of aws-sdk is breaking the build 🚨

The devDependency aws-sdk was updated from 2.504.0 to 2.505.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

aws-sdk is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build succeeded (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).
  • coverage/coveralls: First build on greenkeeper/aws-sdk-2.505.0 at 100.0% (Details).

Release Notes for Release v2.505.0

See changelog for more information.

Commits

The new version differs by 2 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of aws-sdk is breaking the build 🚨

The devDependency aws-sdk was updated from 2.368.0 to 2.369.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

aws-sdk is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for Release v2.369.0

See changelog for more information.

Commits

The new version differs by 1 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of serverless-offline is breaking the build 🚨

The devDependency serverless-offline was updated from 3.28.0 to 3.28.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

serverless-offline is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build passed (Details).
  • coverage/coveralls: First build on greenkeeper/serverless-offline-3.28.1 at 100.0% (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Commits

The new version differs by 5 commits.

  • 24c8e65 v3.28.1
  • 6fb907d Merge pull request #506 from ondrowan/fix-no-auth
  • bcfdbcd Add missing headers to noAuth test case
  • f96faf1 Fix protected routes requiring API key even if noAuth option is set
  • 018497d Add failing test for noAuth option

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 10.12.1 to 10.12.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of serverless-offline is breaking the build 🚨

The devDependency serverless-offline was updated from 5.10.0 to 5.10.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

serverless-offline is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build succeeded (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).
  • coverage/coveralls: First build on greenkeeper/serverless-offline-5.10.1 at 100.0% (Details).

Release Notes for v5.10.1

Bugfixes

  • TypeError: Cannot destructure property version of 'undefined' or 'null' #771
Commits

The new version differs by 2 commits.

  • f801d69 v5.10.1
  • b16c4f5 Remove underscore [bad cherry-pick from v6], fixes #771

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

TypeORM integration

I'm integrating TypeORM and I have encountered some problems, for example:

I created an entity(User)

import {Entity, PrimaryGeneratedColumn, Column} from "typeorm";

@Entity()
export class User {

    @PrimaryGeneratedColumn()
    id: number;

    @Column({
        length: 100
    })
    firstName: string;

    @Column({
        length: 100
    })
    lastName: string;

    @Column({
        length: 100
    })
    email: string;

    @Column()
    password: string;

    @Column()
    createdAt: Date;

    @Column()
    updatedAt: Date;
}

and create user folder with this content:
users.zip

main problem is in users.ts, if I do getCustomRepository(UserRepository) I get

connectionnotfounderror: connection "default" was not found

that is related to getConnection() or createConnection() before that getCustomRepository(UserRepository) for this I create a shared class:

import { Connection, ConnectionManager, getConnectionOptions, createConnection, getConnectionManager } from 'typeorm'
import { SnakeNamingStrategy } from 'typeorm-naming-strategies'
import 'reflect-metadata'

/**
 * Database manager class
 */
export class Database {
    private connectionManager: ConnectionManager

    constructor() {
        this.connectionManager = getConnectionManager()
    }

    public async getConnection(): Promise<Connection> {
        console.log('getConnection');
        const CONNECTION_NAME = `default`

        let connection: Connection

        if (this.connectionManager.has(CONNECTION_NAME)) {
            connection = await this.connectionManager.get(CONNECTION_NAME)

            if (!connection.isConnected) {
                connection = await connection.connect()
            }
        }
        else {

            const connectionOptions = await getConnectionOptions();
            Object.assign(connectionOptions, { namingStrategy: new SnakeNamingStrategy() });
            
            connection = await createConnection(connectionOptions)
        }

        return connection
    }
}

function getConnection() here is async so it returns a promise and dont know how manage this on users.ts for export getUser endpoint.

const db: Database = new Database();

export const getUser: ApiHandler = db.getConnection().then((connection: Connection): ApiHandler => {
const repo: UserRepository = connection.getCustomRepository(UserRepository);
const service: UsersService = new UsersService(repo);
const controller: UsersController = new UsersController(service);
return controller.getUser;
});

So I get

Type 'Promise(ApiHandler)' is not assignable to type 'ApiHandler'

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 11.12.1 to 11.12.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of ts-mockito is breaking the build 🚨

The devDependency ts-mockito was updated from 2.4.0 to 2.4.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

ts-mockito is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of aws-sdk is breaking the build 🚨

The devDependency aws-sdk was updated from 2.431.0 to 2.432.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

aws-sdk is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Release Notes for Release v2.432.0

See changelog for more information.

Commits

The new version differs by 1 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of serverless-offline is breaking the build 🚨

The devDependency serverless-offline was updated from 4.5.0 to 4.5.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

serverless-offline is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build passed (Details).
  • coverage/coveralls: First build on greenkeeper/serverless-offline-4.5.1 at 100.0% (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Commits

The new version differs by 3 commits.

  • d7d3b49 v4.5.1
  • 0f84a91 Merge pull request #601 from juanjoDiaz/fix_scheme_creation_on_missing_header
  • 72aee0c Fix Scheme creation to not throw on missing auth header

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of serverless-offline is breaking the build 🚨

The devDependency serverless-offline was updated from 3.25.14 to 3.25.15.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

serverless-offline is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Commits

The new version differs by 9 commits.

  • eaec2ee update package lock
  • 55cede1 v3.25.15
  • 990994e Merge pull request #491 from clschnei/add-region-env-default
  • 6c94d26 remove travis node version 4
  • bb256fd add travis node versions 8 and 9
  • 55fdc60 Merge pull request #490 from wwsno/run-lint-on-travis
  • eccd315 update version in lockfile
  • 9209917 set AWS_REGION default from provider
  • e6777fb travis: add run lint step to travis configuration, in addition to running test. Fix lint error in index.js.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of aws-sdk is breaking the build 🚨

The devDependency aws-sdk was updated from 2.406.0 to 2.407.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

aws-sdk is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build passed (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Release Notes for Release v2.407.0

See changelog for more information.

Commits

The new version differs by 1 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 12.0.10 to 12.0.11.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of aws-sdk is breaking the build 🚨

The devDependency aws-sdk was updated from 2.350.0 to 2.351.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

aws-sdk is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: Waiting for AppVeyor build to complete (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for Release v2.351.0

See changelog for more information.

Commits

The new version differs by 3 commits.

  • 70cbaa7 Updates SDK to v2.351.0
  • 4073d3d Merge pull request #2342 from srchase/npmignore-additions
  • 13b0dd3 updated npmignore, fix for issue #2341

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of serverless-offline is breaking the build 🚨

The devDependency serverless-offline was updated from 4.9.2 to 4.9.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

serverless-offline is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Commits

The new version differs by 5 commits.

  • 3c400d0 v4.9.3
  • 37d6823 refactor index.js endpointResponseHeaders for inegration lambda
  • 445ebc2 Merge pull request #624 from james-relyea/master
  • 2ac2f80 Strict comparison for undefined header check
  • ff4a534 Fix detection of undefined endpoint response headers

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of aws-sdk is breaking the build 🚨

The devDependency aws-sdk was updated from 2.476.0 to 2.477.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

aws-sdk is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Release Notes for Release v2.477.0

See changelog for more information.

Commits

The new version differs by 1 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 11.11.2 to 11.11.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

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.