Baljeet Singh
Baljeet Singh
NNuxt
Created by Baljeet Singh on 10/7/2024 in #❓・help
I upgraded my personal website from primevue to shadcn-vue, but build is failing on netlify.
Deciding to use vercel going forward.
4 replies
NNuxt
Created by Baljeet Singh on 10/7/2024 in #❓・help
I upgraded my personal website from primevue to shadcn-vue, but build is failing on netlify.
Just deployed on vercel, and it worked well. So, should be an issue with netlify i guess. Anyone else experienced this before. https://baljeetsingh-6g7322qqh-baljeet-singhs-projects-bcdf9fec.vercel.app/
4 replies
NNuxt
Created by Baljeet Singh on 10/7/2024 in #❓・help
I upgraded my personal website from primevue to shadcn-vue, but build is failing on netlify.
I tried this too NODE_OPTIONS=--max_old_space_size=4096 npm run build
4 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
I have now set the blog routes to prerender
'/blog': { prerender: true },
'/blog/**': { prerender: true },
'/blog': { prerender: true },
'/blog/**': { prerender: true },
It works well in general. There is a minor issue with the pagination. I'm using query string params. It works well if i don't prerender routes. But, doesn't work as expected when i prerender (works on local though). If i just use the prev and next buttons it is ok. But, If i'm on a route, let's say https://www.baljeetsingh.in/blog?page=2 and then i try to refresh. It shows the content of the first page always. I assume this is the expected behavior with prerender. Do you have any insights on how you would go about solving this issue.
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
Thanks @manniL / TheAlexLichter it worked 🙂 I have one final issue, hope you don't mind, haha
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
🙂
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
I'll try to replace $fetch in videos too
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
For nuxt content I'm using useAsyncData. I assume this is why it pretenders. <script setup lang="ts"> const { data: courses } = await useAsyncData('courses', () => queryContent('/courses') .without('body') .where({ published: { $eq: true } }) .sort({ publishedAt: -1 }) .find() ); </script>
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
<script setup> const videos = ref([]); onMounted(async () => { const { items } = await $fetch('/api/youtube-videos'); videos.value = items; }); </script>
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
Using server route and youtube api
export default defineEventHandler(async () => {
// Fetch runtime configuration
const runtimeConfig = useRuntimeConfig();

// Fetch data from YouTube API
const data = $fetch(
`https://youtube.googleapis.com/youtube/v3/search?part=snippet&channelId=UCeWvxihiyzB_ic84VWxHVnA&channelType=any&maxResults=50&order=date&key=${runtimeConfig.youtubeApiKey}`
);

// Return the videos
return data;
});
export default defineEventHandler(async () => {
// Fetch runtime configuration
const runtimeConfig = useRuntimeConfig();

// Fetch data from YouTube API
const data = $fetch(
`https://youtube.googleapis.com/youtube/v3/search?part=snippet&channelId=UCeWvxihiyzB_ic84VWxHVnA&channelType=any&maxResults=50&order=date&key=${runtimeConfig.youtubeApiKey}`
);

// Return the videos
return data;
});
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
btw, I had previously added useYoutubeVideos composable and called the youtube api from there. I think then it wasn't calling the api (not certain). But, it felt like creating server route is the right way to hide the key.
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
So, setting all the routes to prerender: true is the correct way? Don't we need to use npm run generate on the server?
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
No description
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
No description
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
Hi @manniL / TheAlexLichter I watched the video and updated the environement variable to NUXT_YOUTUBE_API_KEY on netlify. This looks to be working. Thanks Also, I have set the video route to prerender, but it seems to be hitting the api again and again.
routeRules: {
'/': { prerender: true },
'/videos': { prerender: true },
// '/blog': { prerender: true },
// '/blog/**': { prerender: true },
'/courses': { prerender: true },
'/work': { prerender: true },
'/contact': { prerender: true },
},
routeRules: {
'/': { prerender: true },
'/videos': { prerender: true },
// '/blog': { prerender: true },
// '/blog/**': { prerender: true },
'/courses': { prerender: true },
'/work': { prerender: true },
'/contact': { prerender: true },
},
Am i doing something wrong? I just want to prerender everything if possible. On local I did npm run generate and then used serve on .output/public directory. But, when i use this build command and directory on netlify, the build fails. Currently, it deploy is only working with npm run build and dist . Then, I'm not sure which routes are prerendered.
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
Thanks, np
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
Just tried, it didn't work I also tried NUXT_ENV, still no (Looks like it was requirement for nuxt 2)
26 replies
NNuxt
Created by Baljeet Singh on 9/20/2024 in #❓・help
runtimeConfig not working when website deployed to netlify
do i have to prefix all env variables in netlify with NUXT_
26 replies