Coder Social home page Coder Social logo

aws-lambda-ws-server's Introduction

James Kyburz 👋

Been paid to code since 1998.

I'm a Principal Software Engineer @G-P, I like free and open-source software and all things AWS Serverless / JavaScript 😊.

Currently I'm working on SAM tooling with sam-expand, and starterstack.

GitHub Status

Stats

Top Languages

Commit

aws-lambda-ws-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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

aws-lambda-ws-server's Issues

Deploying without serverless framework

Hi,

Nice repo. Just what I need. If I want to deploy in AWS without serverless it looks like I specify a function based on the code in your usage example as the backend lambda for all routes: $connect, $disconnect, $default, message (and any other custom routes). Is this correct.

Thanks,
Bob

postToConnection can't sign custom domain names

Hi,

I'm trying to use your ws server for a project where I have a custom domain name attached to the API Gateway.

In aws-post-to-connection, an aws4 signed URL is created from the domainName in the context. This works fine if my API url is something like xxxxx.execute-api.my-region.amazonaws.com, but in my case domainName gets set to api.mydomain.com. This makes the call fail (InvalidTokenException, or similar).

I tried adding URL mappings for my stage, so that api.mydomain.com/prod maps to the prod stage, but that doesn't seem to help. The only way I can get it to work is to inject the "real" API url as an ENV variable, and change your code that sets the host to

host: process.env.API_URL || domainName

Is there any way to add support for custom domain names? I'm not 100% sure what's needed to make this work, but currently I have to modify the package code to get this to work properly. Any pointers appreciated.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper 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 click the 'fix repo' button on account.greenkeeper.io.

Doesn't support binary messages

Hi, I'm using this lib with yjs and ran into an error when I saw it was trying to parse the binary message to JSON in local.js. It also tries to parse it again in handler.js. Also it tries to stringify any binary messages sent back to the client.

https://github.com/JamesKyburz/aws-lambda-ws-server/blob/master/packages/aws-lambda-ws-server/src/local.js#L126

https://github.com/JamesKyburz/aws-lambda-ws-server/blob/master/packages/aws-lambda-ws-server/src/handler.js#L17

https://github.com/JamesKyburz/aws-lambda-ws-server/blob/master/packages/aws-lambda-ws-server/src/local.js#L94

Also should note that the postconnection lib also seems not to support binary messages. Note I haven't tested if this is even possible in the cloud yet and it's unfortunately not documented if it is.

https://github.com/JamesKyburz/aws-lambda-ws-server/blob/master/packages/aws-post-to-connection/src/index.js#L15

Normally this seems to conform to the Websocket API specification, but I imagine many libraries are used to communicating binary messages over websockets (see https://tools.ietf.org/html/rfc6455 and search 'binary frame'). There is even a CFN option to enable this:

contentHandlingStrategy: 'CONVERT_TO_BINARY', // see http://amzn.to/39DkYP4

My suggestion would be when parsing JSON fails, fall back to simply not parsing it, or at least check if it's a Buffer which would indicate it's a binary message. Locally on the ws server we also need to specify connection.binaryType = 'arraybuffer', so maybe this is better as a configuration variable.

Edit: feel free to close, I found out AWS doesn't support returning binary messages anyway. i'm going to work with base64 encoded text instead, which is still incompatible with JSON.stringify so something to consider perhaps for the next version (removing json stringify and parse)

How to passing & get event

Hi, Thanks for making these tools.

I have some question, how we can passing params & use an event in our function?
Usually, we use this format for our lambda

exports.handler = async (event, context, callback) => {})

Thanks

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.