GithubHelp home page GithubHelp logo

jameskyburz / aws-lambda-http-server Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 1.0 860 KB

run your http server in a aws lambda function

Home Page: https://npm.im/aws-lambda-http-server

License: Apache License 2.0

JavaScript 100.00%
api-gateway aws-lambda express fastify http http-server https in-memory-httpserver koa nodejs proxy server-base serverless

aws-lambda-http-server's People

Contributors

greenkeeper[bot] avatar jameskyburz avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

rockabe

aws-lambda-http-server's Issues

Couldn't get it to work for a simple express server

Hi!

Thank you for building this package (and the dep packages).

I tried this just like your demo but with a simple express server and serverless but however I noticed:

  1. sls deploy deploys to api gateaway as a REST Api (version 1)
  2. I manually created a http api and pointed to the lambda function created but I get these in the logs when I try to hit the endpoint

2020-11-29T14:38:47.272Z	a49f0436-6698-4feb-8b18-f70602c6700e	ERROR	TypeError: Cannot read property 'toLowerCase' of undefined    at Route._handles_method (/var/task/node_modules/express/lib/router/route.js:63:21)    at next (/var/task/node_modules/express/lib/router/index.js:244:30)    at expressInit (/var/task/node_modules/express/lib/middleware/init.js:40:5)    at Layer.handle [as handle_request] (/var/task/node_modules/express/lib/router/layer.js:95:5)    at trim_prefix (/var/task/node_modules/express/lib/router/index.js:317:13)    at /var/task/node_modules/express/lib/router/index.js:284:7    at Function.process_params (/var/task/node_modules/express/lib/router/index.js:335:12)    at next (/var/task/node_modules/express/lib/router/index.js:275:10)    at query (/var/task/node_modules/express/lib/middleware/query.js:45:5)    at Layer.handle [as handle_request] (/var/task/node_modules/express/lib/router/layer.js:95:5) | 2020-11-29T14:38:47.272Z a49f0436-6698-4feb-8b18-f70602c6700e ERROR TypeError: Cannot read property 'toLowerCase' of undefined at Route._handles_method (/var/task/node_modules/express/lib/router/route.js:63:21) at next (/var/task/node_modules/express/lib/router/index.js:244:30) at expressInit (/var/task/node_modules/express/lib/middleware/init.js:40:5) at Layer.handle [as handle_request] (/var/task/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/var/task/node_modules/express/lib/router/index.js:317:13) at /var/task/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/var/task/node_modules/express/lib/router/index.js:335:12) at next (/var/task/node_modules/express/lib/router/index.js:275:10) at query (/var/task/node_modules/express/lib/middleware/query.js:45:5) at Layer.handle [as handle_request] (/var/task/node_modules/express/lib/router/layer.js:95:5)
-- | --

Am I missing anything / doing something incorrectly?

Using with serverless-offline

Hi,
This package is exactly what I need, thanks so much for making it available!
I'm having a problem testing it with sls-offline.
Is there any reason why this wouldn't work with sls offline?
Below is the error that I'm getting. Thanks so much in advance for any help!

{
"errorMessage": "Uncaught error in your 'proxy' handler",
"errorType": "TypeError",
"stackTrace": [
"TypeError: Cannot read property 'replace' of undefined",
"at module.exports (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\aws-lambda-create-request-response\src\index.js:17:39)",
"at module.exports (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\aws-lambda-http-server\src\index.js:12:24)",
"at handler (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\serverless-offline\src\index.js:909:25)",
"at Object.internals.handler (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\handler.js:96:36)",
"at request._protect.run (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\handler.js:30:23)",
"at module.exports.internals.Protect.internals.Protect.run (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\protect.js:64:5)",
"at exports.execute (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\handler.js:24:22)",
"at each (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\request.js:384:16)",
"at iterate (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\items\lib\index.js:36:13)",
"at done (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\items\lib\index.js:28:25)",
"at internals.Auth.payload (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\auth.js:223:16)",
"at each (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\request.js:384:16)",
"at iterate (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\items\lib\index.js:36:13)",
"at done (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\items\lib\index.js:28:25)",
"at internals.payload (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\route.js:393:16)",
"at each (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\request.js:384:16)",
"at iterate (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\items\lib\index.js:36:13)",
"at done (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\items\lib\index.js:28:25)",
"at module.exports.internals.Auth.internals.Auth._authenticate (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\auth.js:210:16)",
"at internals.Auth.authenticate (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\auth.js:202:17)",
"at each (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\request.js:384:16)",
"at iterate (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\items\lib\index.js:36:13)",
"at done (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\items\lib\index.js:28:25)",
"at internals.state (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\route.js:357:16)",
"at each (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\request.js:384:16)",
"at iterate (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\items\lib\index.js:36:13)",
"at Object.exports.serial (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\items\lib\index.js:39:9)",
"at internals.Request._lifecycle (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\request.js:387:11)",
"at internals.Request._execute (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\request.js:302:21)",
"at Domain.request._protect.enter (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\connection.js:261:25)",
"at Domain.run (domain.js:242:14)",
"at module.exports.internals.Protect.internals.Protect.enter (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\protect.js:80:17)",
"at Server. (C:\Users\christop\Documents\Stuff\Digital\Projects\testlambdaserver\node_modules\hapi\lib\connection.js:259:30)",
"at emitTwo (events.js:126:13)",
"at Server.emit (events.js:214:7)",
"at parserOnIncoming (_http_server.js:619:12)"
],
"offlineInfo": "If you believe this is an issue with the plugin please submit it, thanks. https://github.com/dherault/serverless-offline/issues"
}

Please provide typescript example

Hi, can you please provide an example of how to use this packages with typescript?

  • server.js > server.ts
  • aws-lambda.js > aws-lambda.ts

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

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.