ixahmedxi / orbitkit

🚀 Orbitkit is a monorepo starterkit aiming to be the foundation you build your next startup or big idea upon.
https://orbitkit.dev
MIT License
799 stars 46 forks source link

I'm not able to build the project locally, even after following the steps in the contributing file. #78

Closed 0xmbadr closed 3 months ago

0xmbadr commented 3 months ago

Describe the bug I am trying to run the template locally. however, after creating .env.local in apps/web and running bun turbo build an issue of Invalid environment variables has shown up.

Apparently,DATABASE_URL is not accessible during executing drizzle-kit generate command.

To Reproduce Steps to reproduce the behavior:

  1. clone the project into a directory of choice.
  2. run bun install
  3. create .env.local in apps/web and fill it (make sure to fill all required variables, especially DATABASE_URL)
  4. run bun turbo build

Expected behavior The project should be successfully built.

Additional context

@orbitkit/db#db:generate > cache miss, executing 7252559029528ce2 
│ $ drizzle-kit generate
│ drizzle-kit: v0.22.7
│ drizzle-orm: v0.31.2
│ 
│ No config path provided, using default 'drizzle.config.ts'
│ Reading config file '/home/badr/../orbitkit/packages/db/drizzle.config.ts'
│ ❌ Invalid environment variables: { DATABASE_URL: [ 'Required' ] }
│ /home/badr/.../orbitkit/node_modules/@t3-oss/env-core/dist/index.js:29
│         throw new Error("Invalid environment variables");
...
│ Node.js v21.5.0
│ error: script "db:generate" exited with code 1
│ command finished with error: command (/home/badr/.../orbitkit/packages/db) /home/badr/.bun/bin/bun run db
│ :generate exited (1)

...

ERROR  run failed: command  exited (1)
error: "turbo" exited with code 1
imCorfitz commented 3 months ago

Did you symlink the env file as per the documentation? https://orbitkit.dev/installation#configuring-environment-variables

# Copy the .env.example file into a .env.local file.
cp ./apps/web/.env.example ./apps/web/.env.local

# You will also need to symlink that file into the packages/db directory as a `.env` file.
cd packages/db && ln -s ../../apps/web/.env.local .env
0xmbadr commented 3 months ago

I didn't. This apparently solves it. Thank you.