yaviscoke
yaviscoke
Explore posts from servers
TTCTheo's Typesafe Cult
Created by yaviscoke on 12/14/2023 in #questions
tRPC query has any type
I'm using turbo repo for trpc (with express) and react-native, I made mutation query, but in client side when I try to use trpc it has any type on queries @/api/auth
export const auth = publicProcedure
.input(
z.object({
token: z.string(),
provider: z.enum(["google", "apple", "spotify"]),
})
)
// ...
export const auth = publicProcedure
.input(
z.object({
token: z.string(),
provider: z.enum(["google", "apple", "spotify"]),
})
)
// ...
server.ts
import { createTRPCRouter } from ".";
import { auth } from "@/api/auth";

export const appRouter = createTRPCRouter({ auth });

export type AppRouter = typeof appRouter;
import { createTRPCRouter } from ".";
import { auth } from "@/api/auth";

export const appRouter = createTRPCRouter({ auth });

export type AppRouter = typeof appRouter;
and from index.ts I export AppRouter type client.ts
import { createTRPCReact } from '@trpc/react-query'
import type { AppRouter } from 'backend'

export const api = createTRPCReact<AppRouter>()
import { createTRPCReact } from '@trpc/react-query'
import type { AppRouter } from 'backend'

export const api = createTRPCReact<AppRouter>()
so whenever I use api.auth auth type is any but why?? I don't get it I actually followed t3-app configuration of nextjs
11 replies
TTCTheo's Typesafe Cult
Created by yaviscoke on 11/17/2023 in #questions
Next-auth redirects me on auth/error on signIn()
I'm using app router in nextjs, when I call signIn("google") in localhost, next-auth works pretty well but on production, it redirects me instantly on api/auth/error route this is my app/api/auth/[...next-auth]/route.ts look like
import { env } from "@/env";
import NextAuth, { type NextAuthOptions } from "next-auth";
import GoogleProvider from "next-auth/providers/google";

export const authOptions: NextAuthOptions = {
providers: [
GoogleProvider({
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_SECRET,
}),

],
session: { strategy: "jwt" }
};

const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };
import { env } from "@/env";
import NextAuth, { type NextAuthOptions } from "next-auth";
import GoogleProvider from "next-auth/providers/google";

export const authOptions: NextAuthOptions = {
providers: [
GoogleProvider({
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_SECRET,
}),

],
session: { strategy: "jwt" }
};

const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };
what can be problem? in production I think, env are all good
9 replies
RRailway
Created by yaviscoke on 10/19/2023 in #✋|help
chmod -x command in railway
is it possible to run chmod +x /app/node_modules/... this command on railway? I was having permission error locally and fixed it with chmod but now on railway getting same error
14 replies
RRailway
Created by yaviscoke on 10/18/2023 in #✋|help
ffmpeg | ffprobe EACCES error on nodejs production server
No description
16 replies
TTCTheo's Typesafe Cult
Created by yaviscoke on 10/8/2023 in #questions
metadata in next-auth
in next-auth is it possible to add metadata for special authrozations?
signIn('google', { metadata: {code: "extra data here"}))
signIn('google', { metadata: {code: "extra data here"}))
and I want to get this metadata in session
callbacks: {
session: async ({ session, token }) => {
console.log(session.metadata.code)

return session
},
callbacks: {
session: async ({ session, token }) => {
console.log(session.metadata.code)

return session
},
it would be nicer if I can get that metadata in createUser
2 replies
TTCTheo's Typesafe Cult
Created by yaviscoke on 8/28/2023 in #questions
get user ip in trpc
I know https://www.answeroverflow.com/m/1097080265928609802 in here the question is already answered but i get value in ip as ::ffff:127.0.0.1 this instead of real ip here is how I do that
export const createTRPCContext = async (opts: CreateNextContextOptions) => {
const { req, res } = opts

let ip = req.headers['x-forwarded-for'] as string
const session = await getServerAuthSession({ req, res })

return createInnerTRPCContext({
session,
ip
})
}
export const createTRPCContext = async (opts: CreateNextContextOptions) => {
const { req, res } = opts

let ip = req.headers['x-forwarded-for'] as string
const session = await getServerAuthSession({ req, res })

return createInnerTRPCContext({
session,
ip
})
}
and when I make request I receive in response that ::ffff:127.0.0.1 thats testing response
.mutation(async ({ ctx }) => {
return { success: true, ip: ctx.ip }
})
.mutation(async ({ ctx }) => {
return { success: true, ip: ctx.ip }
})
4 replies
RRailway
Created by yaviscoke on 7/23/2023 in #✋|help
Regions
on railway is it possible to change regions?
14 replies
RRailway
Created by yaviscoke on 7/22/2023 in #✋|help
Rust server fails on railway
I'm trying to host my rust server on railway I use this guy's template https://railway.app/template/4lz789, when project build main panics and throws error about OPENSSL here is full error
#13 1.381 --- stderr
#13 1.381 thread 'main' panicked at '
#13 1.381
#13 1.381 Could not find directory of OpenSSL installation, and this `-sys` crate cannot
#13 1.381 proceed without this knowledge. If OpenSSL is installed and this crate had
#13 1.381 trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
#13 1.381 compilation process.
#13 1.381
#13 1.381 Make sure you also have the development packages of openssl installed.
#13 1.381 For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
#13 1.381
#13 1.381 If you're in a situation where you think the directory *should* be found
#13 1.381 automatically, please open a bug at https://github.com/sfackler/rust-openssl
#13 1.381 and include information about your system as well as this message.
#13 1.381
#13 1.381 $HOST = x86_64-unknown-linux-gnu
#13 1.381 $TARGET = x86_64-unknown-linux-musl
#13 1.381 openssl-sys = 0.9.90
#13 1.381 --- stderr
#13 1.381 thread 'main' panicked at '
#13 1.381
#13 1.381 Could not find directory of OpenSSL installation, and this `-sys` crate cannot
#13 1.381 proceed without this knowledge. If OpenSSL is installed and this crate had
#13 1.381 trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
#13 1.381 compilation process.
#13 1.381
#13 1.381 Make sure you also have the development packages of openssl installed.
#13 1.381 For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
#13 1.381
#13 1.381 If you're in a situation where you think the directory *should* be found
#13 1.381 automatically, please open a bug at https://github.com/sfackler/rust-openssl
#13 1.381 and include information about your system as well as this message.
#13 1.381
#13 1.381 $HOST = x86_64-unknown-linux-gnu
#13 1.381 $TARGET = x86_64-unknown-linux-musl
#13 1.381 openssl-sys = 0.9.90
how can I fix that issue?
37 replies
TTCTheo's Typesafe Cult
Created by yaviscoke on 6/29/2023 in #questions
Uploadthing: do not upload immediately
in upload thing is it possible when putting the file in uploader do not upload immediately? i want when I click form button start upload after that not after putting file there
3 replies
TtRPC
Created by yaviscoke on 5/26/2023 in #❓-help
How to not send request in specific condition in useQuery()
const { data: artists, isLoading } = api.findArtist.useQuery({
name: search,
});
const { data: artists, isLoading } = api.findArtist.useQuery({
name: search,
});
I have this in my code so in beginning search is empty string and is it possible to write condition when it should run request and when not, when search is empty I dont want to run request
4 replies
TTCTheo's Typesafe Cult
Created by yaviscoke on 4/15/2023 in #questions
Connect Prisma to AWS RDS Database (PostgreSQL)
4 replies
TTCTheo's Typesafe Cult
Created by yaviscoke on 3/13/2023 in #questions
Form Submiting Doesn't Work, It refetches getStaticProps instead
8 replies
RRailway
Created by yaviscoke on 2/28/2023 in #✋|help
Nodejs server takes up too long to host
43 replies
TTCTheo's Typesafe Cult
Created by yaviscoke on 2/6/2023 in #questions
Why useQuery runs multiple times?
9 replies
TTCTheo's Typesafe Cult
Created by yaviscoke on 1/31/2023 in #questions
is it problem to install next-auth by hand?
6 replies