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

feat(remix-architect): support API gateway v1 #3173

Closed

Conversation

wingleung
Copy link

Closes: #2696

  • Docs
  • Tests

Testing Strategy:

added jest tests for...

  • the new parts (v1-test.ts and server-test.ts)
  • moved existing tests to logical location (v2-test.ts and server-test.ts)

Just a proposal to get this started. I need API Gateway V1 integration because it supports features we need that are not available in v2

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented May 12, 2022

Hi @wingleung,

Welcome, and thank you for contributing to Remix!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run.

Thanks!

- The Remix team

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented May 12, 2022

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@MichaelDeBoey MichaelDeBoey changed the title add api gateway v1 integration feat(remix-architect): support API gateway v1 May 12, 2022
@MichaelDeBoey MichaelDeBoey requested a review from mcansh May 12, 2022 13:27
@remix-run remix-run deleted a comment from changeset-bot bot May 12, 2022
Wing Leung added 2 commits May 17, 2022 17:07
…teway-v1

# Conflicts:
#	packages/remix-architect/__tests__/server-test.ts
#	packages/remix-architect/server.ts
@mcansh
Copy link
Collaborator

mcansh commented May 18, 2022

sweet! from first glance it looks good to me - I'll take a more in depth look in a few minutes :)

@mcansh
Copy link
Collaborator

mcansh commented May 18, 2022

do you have an example repo of this? I'm not having much luck using arc.codes with it, but i could be doing something wrong.

@wingleung
Copy link
Author

wingleung commented May 19, 2022

do you have an example repo of this? I'm not having much luck using arc.codes with it, but i could be doing something wrong.

Thanks for reviewing @mcansh !

I was a bit behind on dev so this PR was indeed broken, my bad. I updated this PR again, I don't use architect but I've tested it with the grunge stack which uses architect and I have it running here in a separate temp branch 👉 wingleung/pull/1 could you try again?

sidenote, we use sam cli as local dev tool and a custom pipeline on jenkins to deploy our stack.

packages/remix-architect/server.ts Outdated Show resolved Hide resolved
packages/remix-architect/api/v1.ts Outdated Show resolved Hide resolved
packages/remix-architect/api/v1.ts Outdated Show resolved Hide resolved
packages/remix-architect/api/v2.ts Outdated Show resolved Hide resolved
packages/remix-architect/api/v2.ts Outdated Show resolved Hide resolved
packages/remix-architect/api/v1.ts Outdated Show resolved Hide resolved
wingleung and others added 6 commits June 9, 2022 19:59
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
packages/remix-architect/index.ts Outdated Show resolved Hide resolved
@wingleung
Copy link
Author

@mcansh any idea when this one can be merge? I'm using a custom build now but it's getting a little harder to keep everything up to date 😅 let me know if you want more info

@mcansh
Copy link
Collaborator

mcansh commented Jul 1, 2022

sorry @wingleung! this keeps getting lost in my sea of tabs - gonna give it another look over and re-verify it's something we want first party support for.

I've also haven't been able to run an example thus far, but I'll try again today

@ryanflorence
Copy link
Member

Appreciate the work here. It's difficult for us to know all of the different deployment targets well and don't want to be in people's way like this. I personally barely knew enough to make this adapter in the first place and to now support two versions of API Gateway is stretching us even farther.

We had to ship with a few "first party" adapters ourselves (because who cares about a new javascript framework?) but the design of Remix is that you can make your own adapter. Long term the adapters should be maintained by the community and the hosts.

What if you made your own API Gateway adapter instead? Then more people can deploy to it w/o needing Architect?

@wingleung
Copy link
Author

@ryanflorence thanks for the insight on the long term strategy here, I definitely understand you want to focus on the core of Remix. And I have no problem splitting this into a separate community project in a leaner form without architect or move it into an /examples folder with other example integrations like you guys do in Remix, I'll get it up and running in the next few days and update this PR and #2696

keep you posted!

@RichiCoder1
Copy link

@ryanflorence thanks for the insight on the long term strategy here, I definitely understand you want to focus on the core of Remix. And I have no problem splitting this into a separate community project in a leaner form without architect or move it into an /examples folder with other example integrations like you guys do in Remix, I'll get it up and running in the next few days and update this PR and #2696

keep you posted!

Let me know how you get along with this! I'd be happy to chip in. Def an interesting problem, especially since there's arguably three relevant payload and response formats: API Gateway v1 & v2, as well as ALB. I've heard rumors that there might be a new streaming response format too, which would also justify a seperate implementation. (Plus I find it personally confusing the package is named architect when it's technically compatible with Serverless, SST, or any other AWS Lambda framework.)

@MichaelDeBoey
Copy link
Member

MichaelDeBoey commented Jul 6, 2022

as well as ALB

@RichiCoder1 We have an open issue to support ALB response format by @parisholley for this.

Plus I find it personally confusing the package is named architect when it's technically compatible with Serverless, SST, or any other AWS Lambda framework.

We have an open issue to rename @remix-run/architect to @remix-run/aws-lambda by @shamsup for this.

@wingleung
Copy link
Author

wingleung commented Jul 7, 2022

Let me know how you get along with this! I'd be happy to chip in. Def an interesting problem, especially since there's arguably three relevant payload and response formats: API Gateway v1 & v2, as well as ALB. I've heard rumors that there might be a new streaming response format too, which would also justify a seperate implementation. (Plus I find it personally confusing the package is named architect when it's technically compatible with Serverless, SST, or any other AWS Lambda framework.)

@RichiCoder1 Haven't got around to separate it yet but idd the architect would be removed to keep the adapter lean. I think having a separate adapter per aws service would also keep things lean so in the ALB vs API Gateway scenario we would have

  • remix-aws-api-gateway
  • remix-aws-application-load-balancer or remix-aws-alb

if we would go with remix-aws-lambda then I guess we would add support for all AWS proxies which might be too big of a scope.

The remix guys also have split their server adapters according to third party service for example the cloudflare adapters

  • @remix-run/cloudflare-pages
  • @remix-run/cloudflare-workers

Having said that, I wonder if there is any overlap in the request en response structure that an ALB and API GW requires and if AWS will keep this overlap going further 🤔
Looking at the ALB docs there is some similarities with the API GWv1 structure

So there is an advantage when all the integration code is together in a remix-aws-lambda package 😄 WDYT?

@RichiCoder1
Copy link

RichiCoder1 commented Jul 13, 2022

So there is an advantage when all the integration code is together in a remix-aws-lambda package 😄 WDYT?

@wingleung I don't have hard data to back this up, but I think the events share enough commonality and don't differ wildly enough to justify separating into their own packages. A converged package with event detection should be more than good enough!

At least in the case of pages/workers, the deployment and events are materially different enough to justify it (even if the runtime is largely the same)

@wingleung
Copy link
Author

@RichiCoder1 I kickstarted Remix AWS where I removed the Architect part and focused on adding support for the application load balancer.

Almost every property the ALB needs is already being used in the API Gateway v1. I've added some more info about this in the readme.

Event detection itself could be an iteration on this idd.

@wingleung
Copy link
Author

@kamtugeza raises a good point in wingleung/remix-aws#2. the only thing we would want to move to another package would be the adapters. a createRequestHandler could potentially stay in remix-core, it might keep the integrations aligned in remix-core

@chaance
Copy link
Collaborator

chaance commented Sep 15, 2022

Housekeeping! I'm going to close this for now, as it seems like the consensus is that this should be maintained as a community package outside of Remix. Feel free to ping if you feel I missed any context and we need to reconsider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants