tierrun / tier-vercel-openai

This project generates marketing content using OpenAI, implements metered pricing model, checks for feature access based on their current subscription, reports usage of a feature, manages subscription and more using Tier.
https://tier-vercel-openai.vercel.app
MIT License
335 stars 49 forks source link

Running Locally - Documentation Issues - Improvement Suggestions. #2

Open sonicviz opened 1 year ago

sonicviz commented 1 year ago

Hi,

This looks really interesting so I gave it a shot to try out.

Initially I got a bunch of build version errors (iirc svelte mismatch from ai package) so I just --forced them for now.

I eventually got it running filling in some of the .env variables, but the documentation isn't very clear between what is needed for running locally and what is needed for running on vercel. I'd like to get it running locally before doing a test deploy, as that's a basic test you need to pass.

So I'd like to request more clarity in the documentation that makes clear what exactly needs to be filled in the .env local for a local development vs a remote install. You can't make assumptions here, documentation needs to be clear and really spell it out. I think if you do this it will also be a great value add to the app by bringing clarity to the two deployment pathways. At the moment they're both mashed up in one set of bullet points. Confusing.

eg: It implies postgre env variables are not needed for local dev but I get errors, as shown below. The obvious implication here is you do need the postgre db set up for local dev, but on the linked Vercel page https://vercel.com/docs/storage/vercel-postgres/quickstart it says you need an existing vercel project. But, we're still at the local testing stage, not deployed, so we don't have a vercel project. I am familiar with Vercel, I have a number of projects there, but this is confusing to me! Things might sound obvious to you if you're had your head in the technical weeds developing this, but for fresh eyes you really need to assume someone knows nothing, so spell it out in more detail is what I would recommend.

A good example of this would be the local dev setup instuctions here: https://github.com/a16z-infra/ai-getting-started , which you can see break it out more explicitly into steps for obtaining the API keys and where to put them, then for running locally, then for doing a test deploy.

Errors:

┌ GET /?_rsc=17aedda 200 in 163ms │ └──── GET https://api.github.com/repos/tierrun/tier-verc.. 200 in 6ms (cache: HIT)

[next-auth][error][adapter_error_getUserByAccount] https://next-auth.js.org/errors#adapter_error_getuserbyaccount Invalid p.account.findUnique() invocation in /mnt/e/Source Control/AI Apps/Frameworks/tier-vercel-openai2/node_modules/@next-auth/prisma-adapter/dist/index.js:211:45

208 getUserByEmail: (email) => p.user.findUnique({ where: { email } }), 209 async getUserByAccount(provider_providerAccountId) { 210 var _a; → 211 const account = await p.account.findUnique( error: Error validating datasource db: the URL must start with the protocol postgresql:// or postgres://.

I also tried to sign up locally with the github auth keys I set up for the app, but it got rejected as well.

On the .env as well, I thought infisical was going to be used for this anyway, so also found that a little confusing. Is the infisical integraiton not set up atm?

Thanks, Paul

jerriclynsjohn commented 1 year ago

We are working on a step-by-step tutorial based on this template to make things easy. This template Readme instruction for envs assumes that you are using the Vercel - "Click to Deploy" which will auto inject Postgres envs to your Vercel Project.

The current template assumes you are using Vercel Postgres by default. We have also provided Prisma schema files for both Planetscale and Supabase. Now if you want to use Postgres from your machine locally you will need to use a DB connection string and you can construct that as mentioned here https://www.prisma.io/docs/concepts/database-connectors/postgresql#connection-details

ENV requirements are mentioned at env.example

Specifically for Vercel Postgres, you will need these envs

POSTGRES_PRISMA_URL=
POSTGRES_URL_NON_POOLING=

We are working on in-depth documentation to help the community understand the template better.

Your build errored out because you do not have a DB connection string.

Regarding the Svelte error during build, I've reported it to Vercel who manages the ai library. You can check the progress here https://github.com/vercel-labs/ai/issues/248

sonicviz commented 1 year ago

Sounds great! Thanks for the quick reply.

Do you know roughly when you might have your tutorial ready?

jerriclynsjohn commented 1 year ago

You can expect it by next week, I'll keep the issue open till its live.

sonicviz commented 1 year ago

Awesome, thanks!

jerriclynsjohn commented 1 year ago

You can expect something by the end of the week

sonicviz commented 5 months ago

Is Tier dead/dying?

tier.run shows: Page not found The page you are looking for doesn't exist or has been moved.

Came back to check out progress!