dai-shi / waku

⛩️ The minimal React framework
https://waku.gg
MIT License
4.08k stars 108 forks source link

feat: output AWS Lambda handler #419

Closed aheissenberger closed 4 months ago

aheissenberger commented 4 months ago

experimental!

suggested AWS setup:

Demo Repo

https://github.com/aheissenberger/waku-aws-lambda-demo

(needs to be linked to my fork to work)

Please provide some feedback: 1) the current implementation tries to keep the needed transformations of the output in output-aws-lambda.ts which requires the build process to repeate to include the external dependencies 2) when doing the second build step rollup is not able to find the hono package. This package needs to be added to the WAKU project to avoid the build to fail.

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
waku ✅ Ready (Inspect) Visit Preview Feb 5, 2024 2:46pm
codesandbox-ci[bot] commented 4 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d7f4f3570a8ec476fe5f8edae535dd76b9762aba:

Sandbox Source
Vanilla Typescript Configuration
React Configuration
React TypeScript Configuration
dai-shi commented 4 months ago

Hi, nice work!

experimental!

Let's make it a draft PR for the time.

CloudFront Function which intercepts all requests to Lambda Function and redirects to S3 bucket based on a list of static routes - optional to reduce the calls to the lambda function

I'm working on some (big) changes to make this possible. Stay tuned.

  1. the current implementation tries to keep the needed transformations of the output in output-aws-lambda.ts which requires the build process to repeate to include the external dependencies

What does that mean? Ah, you are using vite build. Yeah, we want to avoid it if possible.

  1. when doing the second build step rollup is not able to find the hono package. This package needs to be added to the WAKU project to avoid the build to fail.

I'll work on it for output-vercel later. Please wait for that.

aheissenberger commented 4 months ago

@dai-shi any idea why switching to Lambda response streaming does not work? https://hono.dev/getting-started/aws-lambda#lambda-response-streaming

I switched the handler to streamHandle and added RESPONSE_STREAM in serverless.yml

functions:
  ssr:
    handler: dist/serve.handler
    events:
      - httpApi: "*"
    url:
      invokeMode: RESPONSE_STREAM
dai-shi commented 4 months ago

Unfortunately, I'm not very familiar with Lambda.

dai-shi commented 4 months ago

I'll work on it for output-vercel later. Please wait for that.

Still work in progress, but #442 will be ready eventually.

aheissenberger commented 4 months ago

I have added a short info in the README.md.

I would suggest to provide one project in the example folder which includes a working Serverless framework configuration file.

dai-shi commented 4 months ago

thanks. readme should be kept short. we may have docs/* if we need detailed explanation.

as for examples, we already have many examples and i'm trying to reduce them. maybe, we should create a new repository for examples, eventually.

dai-shi commented 4 months ago

442 is already merged and #443 is ready. I think it helps you to finish up this PR.