Invalid environment variables error | My Biggest Tutorial Ever Video

i'm getting this error while following Theo's latest tutorial. The error looks something like this:
❯ pnpm run db:push

> [email protected] db:push /home/anar/Music/anar/gh/drive-tutorial
> drizzle-kit push

No config path provided, using default 'drizzle.config.ts'
Reading config file '/home/anar/Music/anar/gh/drive-tutorial/drizzle.config.ts'
❌ Invalid environment variables: { SINGLESTORE_USER: [ 'Required' ] }
Invalid environment variables
 ELIFECYCLE  Command failed with exit code 1.
❯ pnpm run db:push

> [email protected] db:push /home/anar/Music/anar/gh/drive-tutorial
> drizzle-kit push

No config path provided, using default 'drizzle.config.ts'
Reading config file '/home/anar/Music/anar/gh/drive-tutorial/drizzle.config.ts'
❌ Invalid environment variables: { SINGLESTORE_USER: [ 'Required' ] }
Invalid environment variables
 ELIFECYCLE  Command failed with exit code 1.
drizzle.config:
import { type Config } from "drizzle-kit";

import { env } from "~/env";

export default {
schema: "./src/server/db/schema.ts",
dialect: "singlestore",
tablesFilter: ["drive_tutorial_*"],
dbCredentials: {
host: env.SINGLESTORE_HOST,
port: parseInt(env.SINGLESTORE_PORT),
user: env.SINGLESTORE_USER,
password: env.SINGLESTORE_PASS,
database: env.SINGLESTORE_DB_NAME,
ssl: {},
},
} satisfies Config;
import { type Config } from "drizzle-kit";

import { env } from "~/env";

export default {
schema: "./src/server/db/schema.ts",
dialect: "singlestore",
tablesFilter: ["drive_tutorial_*"],
dbCredentials: {
host: env.SINGLESTORE_HOST,
port: parseInt(env.SINGLESTORE_PORT),
user: env.SINGLESTORE_USER,
password: env.SINGLESTORE_PASS,
database: env.SINGLESTORE_DB_NAME,
ssl: {},
},
} satisfies Config;
Solution:
fixed now, the issue was with the SINGLESTORE_DB_NAME. It was different on the singlestore CPanel and my .env.
Jump to solution
4 Replies
kapz
kapz4w ago
You are missing the variable SINGLESTORE_USER in your .env file (do not share it here) The error is giving you this info here: Invalid environment variables: { SINGLESTORE_USER: [ 'Required' ] } Errors are helpers (most times), just look closely at what it's trying to say to you! Good luck!
xyzmani
xyzmaniOP4w ago
i'm sure i have that though:
# When adding additional environment variables, the schema in "/src/env.js"
# should be updated accordingly.

# Drizzle
DATABASE_URL="file:./db.sqlite"

# Example:
# SERVERVAR="foo"
# NEXT_PUBLIC_CLIENTVAR="bar"

SINGLESTORE_USER="{RETRACTED}"
SINGLESTORE_PASS="{RETRACTED}"
SINGLESTORE_HOST="{RETRACTED}"
SINGLESTORE_PORT="3333"
SINGLESTORE_DB_NAME="drive"

MORE ENV STUFF...
# When adding additional environment variables, the schema in "/src/env.js"
# should be updated accordingly.

# Drizzle
DATABASE_URL="file:./db.sqlite"

# Example:
# SERVERVAR="foo"
# NEXT_PUBLIC_CLIENTVAR="bar"

SINGLESTORE_USER="{RETRACTED}"
SINGLESTORE_PASS="{RETRACTED}"
SINGLESTORE_HOST="{RETRACTED}"
SINGLESTORE_PORT="3333"
SINGLESTORE_DB_NAME="drive"

MORE ENV STUFF...
just made sure and re-ran the command, now it returns this:
❯ pnpm run db:push

> [email protected] db:push /home/anar/Music/anar/gh/drive-tutorial
> drizzle-kit push

No config path provided, using default 'drizzle.config.ts'
Reading config file '/home/anar/Music/anar/gh/drive-tutorial/drizzle.config.ts'
 ELIFECYCLE  Command failed with exit code 1.
❯ pnpm run db:push

> [email protected] db:push /home/anar/Music/anar/gh/drive-tutorial
> drizzle-kit push

No config path provided, using default 'drizzle.config.ts'
Reading config file '/home/anar/Music/anar/gh/drive-tutorial/drizzle.config.ts'
 ELIFECYCLE  Command failed with exit code 1.
xyzmani
xyzmaniOP4w ago
the actual errors from the drizzle.config are these:
No description
Solution
xyzmani
xyzmani4w ago
fixed now, the issue was with the SINGLESTORE_DB_NAME. It was different on the singlestore CPanel and my .env.

Did you find this page helpful?