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

Add a Lambda Handler #16

Open
perfectbase opened this issue Jul 15, 2022 · 6 comments
Open

Add a Lambda Handler #16

perfectbase opened this issue Jul 15, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@perfectbase
Copy link

I would love to see a handler for deploying the playground on an AWS Lambda + ApiGateway structure.

Here I have an example project:
https://github.com/perfectbase/serverless-trpc

It's a Next.js app with an API build with Serverless Framework.

While we don't have a Lambda Handler, I've been trying a workaround by trying to put only the playground in the Next.js's API Routes. But I wasn't successful with it.

Could you try to guide me in how I can make it work with my setup?

Thanks in advance.

@sachinraja
Copy link
Owner

It's easy enough for me to add a lambda handler now via https://github.com/sachinraja/uttp. The only problem is that I have no idea how to test if it actually works.

@sachinraja sachinraja added the enhancement New feature or request label Jul 15, 2022
@perfectbase
Copy link
Author

@sachinraja Thanks for the reply! And for the guidance!
I'll try to take a look at it today.

@perfectbase
Copy link
Author

@sachinraja I tried to follow the CONTRIBUTING.md instructions, but wasn't successful to make it work on the example apps.

Here is my system:

  • macOS Monterey (12.3) M1
  • node: v16.16.0
  • pnpm: 6.33.1 and 7.5.1 (tried with both)

What I did:

  • forked and cloned the repo
  • installed pnpm with npm i -g pnpm
  • pnpm i
  • cd apps/vite
  • pnpm dev

This throws an error:

✘ [ERROR] Could not resolve "@trpc-playground/html"

    <stdin>:1:7:
      1 │ import "@trpc-playground/html"
        ╵        ~~~~~~~~~~~~~~~~~~~~~~~

Tried with the 'next' and 'express' examples as well, but wasn't successful.

image

Am I doing something wrong?

Could you tell me your system and versions so I can try to match them as close as possible?

@sachinraja
Copy link
Owner

sachinraja commented Jul 16, 2022

You need to run pnpm build in the root I think. Sorry for any issues, the CONTRIBUTING document there is incomplete since it was just me working on this project.

If you need more help on this we could maybe do a call on the trpc discord.

@perfectbase
Copy link
Author

Thanks! I could make it work for the vite example.
And I think I got really close to making it work for my Serverless Framework setup.

I would like to talk on the discord some time! My name there is Ravi Souza#8573
I live in Japan, so I'll be going to sleep soon.
Tell me when we can do the call. I'll be mostly free tomorrow.

@sachinraja
Copy link
Owner

sachinraja commented Jul 16, 2022

Glad you were able to get it working. I might be free tomorrow (today?). I'm in PST. Just @ me on the discord (cloudfox) and we can talk if I'm available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants