heyxyz/hey

Local Development: unable to post on testnet

muttoni opened this issue · 3 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm trying to spin up a local instance of Hey.

I've followed all steps in CONTRIBUTING and LOCAL_DEVELOPMENT_GUIDE.

Everything builds correctly:

hey git:(main) ✗ npm run dev 

> hey@3.0.4-beta dev
> turbo run dev --parallel

• Packages in scope: @hey/abis, @hey/api, @hey/config, @hey/data, @hey/icons, @hey/image-cropper, @hey/lens, @hey/lib, @hey/og, @hey/types, @hey/ui, @hey/web
• Running dev in 12 packages
• Remote caching disabled
@hey/web:dev: cache bypass, force executing a0edd8315d59beb9
@hey/og:dev: cache bypass, force executing 27c73b4e40f3cf35
@hey/api:dev: cache bypass, force executing 14774fb3e8aff9a3
@hey/api:dev: 
@hey/api:dev: > @hey/api@0.0.0 dev [...]/hey/apps/api
@hey/api:dev: > nodemon -w src -x tsx src/server.ts
@hey/api:dev: 
@hey/og:dev: 
@hey/og:dev: > @hey/og@0.0.0 dev [...]/hey/apps/og
@hey/og:dev: > next dev --port 4785
@hey/og:dev: 
@hey/web:dev: 
@hey/web:dev: > @hey/web@0.0.0 dev [...]/hey/apps/web
@hey/web:dev: > next dev --port 4783
@hey/web:dev: 
@hey/api:dev: [nodemon] 3.0.2
@hey/api:dev: [nodemon] to restart at any time, enter `rs`
@hey/api:dev: [nodemon] watching path(s): src/**/*
@hey/api:dev: [nodemon] watching extensions: ts,json
@hey/api:dev: [nodemon] starting `tsx src/server.ts`
@hey/og:dev:    ▲ Next.js 14.0.4
@hey/og:dev:    - Local:        http://localhost:4785
@hey/og:dev: 
@hey/web:dev:    ▲ Next.js 14.0.4
@hey/web:dev:    - Local:        http://localhost:4783
@hey/web:dev:    - Environments: .env
@hey/web:dev:    - Experiments (use at your own risk):
@hey/web:dev:      · scrollRestoration
@hey/web:dev: 
@hey/og:dev:  ✓ Ready in 1537ms
@hey/web:dev:  ✓ Ready in 1827ms
@hey/api:dev: 2:15:32 PM [vite-express] Running in development mode
@hey/api:dev: 2:15:33 PM [vite-express] Using Vite to resolve the config file
@hey/api:dev: Server is listening on port 4784...
@hey/web:dev:  ○ Compiling /404 ...
@hey/web:dev:  ✓ Compiled /404 in 14.9s (5509 modules)
@hey/web:dev:  ⚠ Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/messages/fast-refresh-reload
@hey/web:dev:  ○ Compiling / ...
@hey/web:dev:  ✓ Compiled / in 13.1s (5773 modules)

The website loads perfectly on localhost and am able to login with my testnet handle.
However, as soon as I try to interact and post a message, I get errors due to missing configuration parameters.

@hey/api:dev: ERROR: PrismaClientInitializationError: 
@hey/api:dev: Invalid `prisma.profileFeature.findMany()` invocation in
@hey/api:dev: [...]/hey/apps/api/src/routes/misc/verified.ts:13:46
@hey/api:dev: 
@hey/api:dev:   10 
@hey/api:dev:   11 export const get: Handler = async (_, res) => {
@hey/api:dev:   12   try {
@hey/api:dev: → 13     const data = await prisma.profileFeature.findMany(
@hey/api:dev: error: Error validating datasource `db`: You must provide a nonempty URL. The environment variable `DATABASE_URL` resolved to an empty string.
@hey/api:dev:   -->  schema.prisma:3
@hey/api:dev:    | 
@hey/api:dev:  2 |   provider = "postgresql"
@hey/api:dev:  3 |   url      = env("DATABASE_URL")
@hey/api:dev:    | 
@hey/api:dev: 
@hey/api:dev: Validation Error Count: 1
@hey/api:dev: ERROR: PrismaClientInitializationError: 
@hey/api:dev: Invalid `prisma.group.findMany()` invocation in
@hey/api:dev: [...]/hey/apps/api/src/routes/groups/featured.ts:10:37
@hey/api:dev: 
@hey/api:dev:    7 
@hey/api:dev:    8 export const get: Handler = async (_, res) => {
@hey/api:dev:    9   try {
@hey/api:dev: → 10     const data = await prisma.group.findMany(
@hey/api:dev: error: Error validating datasource `db`: You must provide a nonempty URL. The environment variable `DATABASE_URL` resolved to an empty string.
@hey/api:dev:   -->  schema.prisma:3
@hey/api:dev:    | 
@hey/api:dev:  2 |   provider = "postgresql"
@hey/api:dev:  3 |   url      = env("DATABASE_URL")
@hey/api:dev:    | 
@hey/api:dev: 
@hey/api:dev: Validation Error Count: 1
@hey/api:dev: ERROR: PrismaClientInitializationError: 
@hey/api:dev: Invalid `prisma.preference.findUnique()` invocation in
@hey/api:dev: [...]/hey/apps/api/src/routes/preferences/get.ts:24:27
@hey/api:dev: 
@hey/api:dev:   21 try {
@hey/api:dev:   22   const [preference, pro, features, membershipNft] =
@hey/api:dev:   23     await prisma.$transaction([
@hey/api:dev: → 24       prisma.preference.findUnique(
@hey/api:dev: error: Error validating datasource `db`: You must provide a nonempty URL. The environment variable `DATABASE_URL` resolved to an empty string.
@hey/api:dev:   -->  schema.prisma:3
@hey/api:dev:    | 
@hey/api:dev:  2 |   provider = "postgresql"
@hey/api:dev:  3 |   url      = env("DATABASE_URL")
@hey/api:dev:    | 
@hey/api:dev: ERROR: Error: Expected private key to be an Uint8Array with length 32

What are the steps required to get a local instance working on testnet? I believe the bulk of the issues are on the /api side.

Thanks!

Expected Behavior

Following local development guide, I would expect testnet to run and be able to post.

Steps To Reproduce

  1. Clone repository
  2. Follow steps outlined in LOCAL_DEVELOPMENT_GUIDE
  3. Website runs fine, but unable to post or follow (0x00, the others work)

What platform(s) does this occur on?

Web

What browser(s) does this occur on?

Chrome

Anything else?

image

When clicking "Post" I get 2 error messages.
image

image

Unable to follow 0x00

image image

@muttoni you need env variables in order to work 🙇🏼

Yeah I imagined that's the issue, but how do I get them? I followed the exact steps in the local development guide. I even signed up to clickhouse and ran the migration script, but no luck when adding the database url and stuff to the env variables. Any guidance on this? @bigint

This issue has been locked since it has been closed for more than 10 days.

If you found a concrete bug or regression related to it, please open a new bug report.