Tacoboi99
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
alright thank you i think i understand. will try to follow sanity docs instead of tutorial see if that helps. Otherwise ill just do everything manually. Thank you so much you gave me a lot more clarity of where and why things are going wrong. Sorry for not being specific about my problem in the beginning.
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
as a base url i mean
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
but on vercel i have added the url of the site as a env
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
i just ran it on my terminal npm run build but its also getting error on vercel
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
thanks for the code i was doing something waaaay diffrent
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
i hope to god this is what you were wanting
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
Sorry i am very bad at error handling. Do you want me to create a try catch on the api file or utils?
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
right now my base url is just http//:localhost:3000/ , i googled my issue and a few were saying it was because of the url. I honestly dont have enough knowledge to know why but the env line fixed it. When i had uploaded it it vercel i was gonna take away the line and put in the hosting url and see if it worked.
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
This is what i get from my api:
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
My getStaticProps:
I dont know if this could be the cause of the problem since it was what fixed the whole api problem i had with sanity in my dev environment.
In my .env.local i added
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
Alright so i am coding a portfolio with next.js, typescript and sanity. I have connected sanity (took way too much time for me) and created apis to get the data and then utils functions to fetch from the api and ran the utils function in a getStaticProps. In my dev environment everything work but when i run build i get this error on vercel:
As i understand from googling a little is that either im fetching something that isnt json from sanity or its not fetching and recieveing 404 html. I am very new to solving errors that are more api or backend related so im am a complete 0 at it.
My api looks like this:
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
yes will do
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
alright give me a longer second have to figure out how to format
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
this is my api,
import type { NextApiRequest, NextApiResponse } from "next";
import {groq} from "next-sanity";
import { client } from "../../../sanity.config";
import { PageInfo } from "../../../typings";
const query = groq
*[_type == "pageInfo"][0]
type Data = {
pageInfo: PageInfo
}
export default async function handler(req:NextApiRequest, res: NextApiResponse<Data>) {
const pageInfo : PageInfo = await client.fetch(query);
res.status(200).json({pageInfo});
}47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
my bad hah
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
oh okay give me a sec!
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
its not trpc i am sadly using plain nextjs haha
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/27/2023 in #questions
Run build error
hahaha yeah. thing is its fetching all the data everything works fine in dev but on build it says that what i am fetching is not json. But i turn the res to json in my api
47 replies
TTCTheo's Typesafe Cult
•Created by Tacoboi99 on 10/10/2023 in #questions
Hi! How to not render header component on register and log in page.
That's what I ended up doing. Thanks!
6 replies