hopesix
hopesix
Explore posts from servers
TTCTheo's Typesafe Cult
Created by hopesix on 4/3/2024 in #questions
Can't set env variables in package.json scripts?
src/env.js 1:
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";

export const env = createEnv({
/**
* Specify your server-side environment variables schema here. This way you can ensure the app
* isn't built with invalid env vars.
*/
server: {
DATABASE_URL: z
.string()
.url()
.refine(
(str) => !str.includes("YOUR_PSQL_URL_HERE"),
"You forgot to change the default URL",
),
TEST_DATABASE_URL: z
.string()
.url()
.refine(
(str) => !str.includes("YOUR_TEST_PSQL_URL_HERE"),
"You forgot to change the test URL",
),
NODE_ENV: z
.enum(["development", "test", "production"])
.default("development"),
// APP_ENV: z.string(),
// ENVIRONMENT: z.string(),
},

/**
* Specify your client-side environment variables schema here. This way you can ensure the app
* isn't built with invalid env vars. To expose them to the client, prefix them with
* `NEXT_PUBLIC_`.
*/
client: {
// NEXT_PUBLIC_CLIENTVAR: z.string(),
},

/**
* You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g.
* middlewares) or client-side so we need to destruct manually.
*/
runtimeEnv: {
DATABASE_URL: process.env.DATABASE_URL,
TEST_DATABASE_URL: process.env.TEST_DATABASE_URL,
NODE_ENV: process.env.NODE_ENV,
// APP_ENV: process.env.APP_ENV,
// ENVIRONMENT: process.env.ENVIRONMENT,
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
},
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
* useful for Docker builds.
*/
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
/**
* Makes it so that empty strings are treated as undefined.
* `SOME_VAR: z.string()` and `SOME_VAR=''` will throw an error.
*/
emptyStringAsUndefined: true,
});
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";

export const env = createEnv({
/**
* Specify your server-side environment variables schema here. This way you can ensure the app
* isn't built with invalid env vars.
*/
server: {
DATABASE_URL: z
.string()
.url()
.refine(
(str) => !str.includes("YOUR_PSQL_URL_HERE"),
"You forgot to change the default URL",
),
TEST_DATABASE_URL: z
.string()
.url()
.refine(
(str) => !str.includes("YOUR_TEST_PSQL_URL_HERE"),
"You forgot to change the test URL",
),
NODE_ENV: z
.enum(["development", "test", "production"])
.default("development"),
// APP_ENV: z.string(),
// ENVIRONMENT: z.string(),
},

/**
* Specify your client-side environment variables schema here. This way you can ensure the app
* isn't built with invalid env vars. To expose them to the client, prefix them with
* `NEXT_PUBLIC_`.
*/
client: {
// NEXT_PUBLIC_CLIENTVAR: z.string(),
},

/**
* You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g.
* middlewares) or client-side so we need to destruct manually.
*/
runtimeEnv: {
DATABASE_URL: process.env.DATABASE_URL,
TEST_DATABASE_URL: process.env.TEST_DATABASE_URL,
NODE_ENV: process.env.NODE_ENV,
// APP_ENV: process.env.APP_ENV,
// ENVIRONMENT: process.env.ENVIRONMENT,
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
},
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
* useful for Docker builds.
*/
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
/**
* Makes it so that empty strings are treated as undefined.
* `SOME_VAR: z.string()` and `SOME_VAR=''` will throw an error.
*/
emptyStringAsUndefined: true,
});
3 replies
TTCTheo's Typesafe Cult
Created by rampa2510 on 3/31/2024 in #questions
A guide for tRPC MySQL drizzle testing setup
If you find anything please let me know, I'm also starting unit testing for my app and have no idea where to start. Seems like vitest is pretty widely used, right now I'm trying to get trpc + context working.
5 replies
DTDrizzle Team
Created by hopesix on 2/7/2024 in #help
Can't edit datetime column in drizzle studio "Error: value.toISOString is not a function"
It's specifically an issue with how Drizzle Studio is displaying the Date column, it's altering it via JS
6 replies
DTDrizzle Team
Created by hopesix on 2/7/2024 in #help
Can't edit datetime column in drizzle studio "Error: value.toISOString is not a function"
So I managed to edit the datetime inside of sequel ace connecting it to the db
6 replies
DTDrizzle Team
Created by hopesix on 2/7/2024 in #help
Can't edit datetime column in drizzle studio "Error: value.toISOString is not a function"
No description
6 replies
DTDrizzle Team
Created by hopesix on 2/7/2024 in #help
Can't edit datetime column in drizzle studio "Error: value.toISOString is not a function"
I realized that I never specified mode on the datetime columns, but they should have defaulted to 'string' anyways. I also connected via Sequel Ace and was able to edit and save a change in start_time, the display of the columns is quite different in Sequel Ace (see my next post in this thread for screenshots) However, if I have mode: "string" set for startTime: datetime("start_time", { mode: "string" }).notNull() Then I can't seem to insert into my db as a new Date(), Luxon's toJSDate() or as an toISO() or even just a string like temp. As soon as I specified mode: string I seem to have lost the ability to insert bookings at all with Drizzle.
6 replies
TTCTheo's Typesafe Cult
Created by hopesix on 1/18/2024 in #questions
T3 tRPC tutorials/videos show useQuery / useMutation, but I only see query / mutate?
Figured it out, I was importing import { api } from "@/trpc/server"; instead of import { api } from "@/trpc/react";
6 replies
TTCTheo's Typesafe Cult
Created by hopesix on 1/18/2024 in #questions
T3 tRPC tutorials/videos show useQuery / useMutation, but I only see query / mutate?
No description
6 replies
TTCTheo's Typesafe Cult
Created by Cxstum on 11/29/2023 in #questions
What are the best resources to learn t3 stack right now (with Clerk if possible)??
I've been trying to poke around with this as well, I just finished a react course and I think I need to do a proper NextJS course before dipping my feet into T3 properly lol
5 replies