Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eventbridge events #477

Merged
merged 6 commits into from
Apr 18, 2022
Merged

Conversation

cnuss
Copy link
Contributor

@cnuss cnuss commented Oct 28, 2021

Description of changes:

Similar to #468, adding support for EventBridge events

Checklist

  • Tests have been added and are passing
  • Documentation has been updated

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@cnuss
Copy link
Contributor Author

cnuss commented Oct 28, 2021

hey again @brett-vendia @brettstack !

adding another event source. comments greatly appreciated!

@cnuss
Copy link
Contributor Author

cnuss commented Nov 4, 2021

hey! @brett-vendia @brettstack bubbling this to the top of your inbox. thoughts?

@MontoyaAndres
Copy link

Any update? Or is there a way to create a custom even bridge event for this? I just get this error all the time:
Screen Shot 2022-03-14 at 7 47 00 PM

@MontoyaAndres
Copy link

I tried this:

For the handler file, this is what I did:

require("source-map-support/register");
const serverlessExpress = require("@vendia/serverless-express");
const app = require("./src");
const {
  getRequestValuesFromEventBridge,
  emptyResponseMapper,
} = require("./src/lib/eventSource");

exports.handler = serverlessExpress({
  app,
  eventSource: {
    getRequest: getRequestValuesFromEventBridge,
    getResponse: emptyResponseMapper,
  },
});

This is the code for src/lib/eventSource:

const {
  emptyResponseMapper,
} = require("@vendia/serverless-express/src/event-sources/utils");

const getRequestValuesFromEventBridge = ({ event }) => {
  const method = "POST";
  const headers = { host: "events.amazonaws.com" };
  const body = event;

  return {
    method,
    headers,
    path: "/eventbridge",
    body,
  };
};

module.exports = {
  getRequestValuesFromEventBridge,
  emptyResponseMapper,
};

But It did not work... What can I do? :/

@H4ad
Copy link
Contributor

H4ad commented Apr 15, 2022

@cnuss I created a refactored version of this library called serverless-adapter, still in beta but you can try to see if it works well, has event bridge support and many other event sources.

@brett-vendia brett-vendia merged commit a25cbad into CodeGenieApp:mainline Apr 18, 2022
@brett-vendia
Copy link
Contributor

Thanks @cnuss and apologies for this taking so long!

github-actions bot pushed a commit that referenced this pull request Apr 19, 2022
# [4.6.0](v4.5.4...v4.6.0) (2022-04-19)

### Bug Fixes

* fix minimist security issue ([9be1f96](9be1f96))
* npm audit fix ([0495697](0495697))

### Features

* add Eventbridge events ([#477](#477)) ([a25cbad](a25cbad))
@github-actions
Copy link

🎉 This PR is included in version 4.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

OneDev0411 added a commit to OneDev0411/serverless-express that referenced this pull request Mar 16, 2023
# [4.6.0](CodeGenieApp/serverless-express@v4.5.4...v4.6.0) (2022-04-19)

### Bug Fixes

* fix minimist security issue ([9be1f96](CodeGenieApp/serverless-express@9be1f96))
* npm audit fix ([0495697](CodeGenieApp/serverless-express@0495697))

### Features

* add Eventbridge events ([#477](CodeGenieApp/serverless-express#477)) ([a25cbad](CodeGenieApp/serverless-express@a25cbad))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants