Samuelreichoer
Samuelreichoer
NNuxt
Created by Samuelreichoer on 3/2/2025 in #❓・help
runWithContext not working as expected
@kapa.ai When I return it like that return { title: computed(() => seoMaticData.value?.title), metaTags: computed(() => seoMaticData.value?.metaTags), linkTags: computed(() => seoMaticData.value?.linkTags), jsonLd: computed(() => seoMaticData.value?.jsonLd), } and import it like that const { metaTags, title, linkTags, jsonLd} = await useCraftSeoMatic() I get an ts error that Vue: Property metaTags does not exist on type { title: ComputedRef<string | undefined>; metaTags: ComputedRef<Record<string, any>[] | undefined>; linkTags: ComputedRef<Record<string, any>[] | undefined>; jsonLd: ComputedRef<...>; } | undefined
16 replies
NNuxt
Created by Samuelreichoer on 3/2/2025 in #❓・help
runWithContext not working as expected
When I return it like that return { title: computed(() => seoMaticData.value?.title), metaTags: computed(() => seoMaticData.value?.metaTags), linkTags: computed(() => seoMaticData.value?.linkTags), jsonLd: computed(() => seoMaticData.value?.jsonLd), } and import it like that const { metaTags, title, linkTags, jsonLd} = await useCraftSeoMatic() I get an ts error that Vue: Property metaTags does not exist on type { title: ComputedRef<string | undefined>; metaTags: ComputedRef<Record<string, any>[] | undefined>; linkTags: ComputedRef<Record<string, any>[] | undefined>; jsonLd: ComputedRef<...>; } | undefined
16 replies
NNuxt
Created by Samuelreichoer on 3/2/2025 in #❓・help
runWithContext not working as expected
@kapa.ai Alright so I use this useFetch and want to return all of these properties without loosing reacitvity const { data: seoMaticData, error } = await useFetch(apiEndpoint, { transform: (seoMaticData: SeoData) => { if (!seoMaticData || typeof seoMaticData !== 'object') { console.error('Transformation of SEOmatic data failed, please verify that the SEOmatic endpoint is working correctly') return undefined } return { title: seoMaticData.MetaTitleContainer?.title?.title ?? '', metaTags: generateMetaTags(seoMaticData.MetaTagContainer), linkTags: generateLinkTags(seoMaticData.MetaLinkContainer), jsonLd: seoMaticData.MetaJsonLdContainer ?? {}, }; }, }) how do I do this?
16 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai Transform failed with 1 error: /Users/samuel/Documents/Private-Projekte/00-repos/nuxt-craftcms/src/runtime/composables/useComposables.ts:13:2: ERROR: Unexpected "const" the error happens at the getFullUrl var
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai the code you provided does have a syntax error
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai can i somehow check if i am in prerendering and use another method to determine the url?
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai Nein nitro läuft auf local host somit ist dieses composable export function useCraftFullUrl() { const route = useRoute() const fullUrl = ref(import.meta.server ? useRequestURL().href : window.location.href) watch(route, () => { fullUrl.value = import.meta.server ? useRequestURL().href : window.location.href }) return fullUrl } falsch und kann nicht den richtigen url herausfinden und dann nicht den richtigen query bauen
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
Nein nitro läuft auf local host somit ist dieses composable export function useCraftFullUrl() { const route = useRoute() const fullUrl = ref(import.meta.server ? useRequestURL().href : window.location.href) watch(route, () => { fullUrl.value = import.meta.server ? useRequestURL().href : window.location.href }) return fullUrl } falsch und kann nicht den richtigen url herausfinden und dann nicht den richtigen query bauen
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai Okey ich habe jetzt den fehler gefunden, der nitro host ist localhost und nicht wie gewünscht 'https://craft-nuxt-starter.ddev.site/' wie stelle ich das um?
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
Okey ich habe jetzt den fehler gefunden, der nitro host ist localhost und nicht wie gewünscht 'https://craft-nuxt-starter.ddev.site' wie stelle ich das um?
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai that's the code of useCraftQuery import type { ElementType } from 'js-craftcms-api' import { useCraftUrlBuilder } from 'vue-craftcms' import { useAsyncData } from '#imports' function fetchFn(url: string) { return useAsyncData(craftcms:${url}, () => $fetch(url)) } export function useCraftQuery<T extends ElementType>(elementType: T) { const queryBuilder = useCraftUrlBuilder(elementType) return { ...queryBuilder, one() { const url = queryBuilder.buildUrl('one') return fetchFn(url) }, all() { const url = queryBuilder.buildUrl('all') return fetchFn(url) }, } }
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai Thats my output now: at Promise.then.result (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:101:19) at new Promise (<anonymous>) at asyncData.refresh.asyncData.execute (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:98:21) at initialFetch (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:139:40) at useAsyncData (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:142:21) at fetchFn (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:1124:10) at Object.one (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:1132:14) at file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:1597:146 at withAsyncContext (/var/www/html/nodemodules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:2547:19) at setup (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug_-D9DXkFt-.mjs:1597:52) at sfcmain.setup (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:1652:23) at callWithErrorHandling (/var/www/html/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:86:19)
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai Thats me output at Promise.then.result (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:101:19) at new Promise (<anonymous>) at asyncData.refresh.asyncData.execute (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:98:21) at initialFetch (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:139:40) at useAsyncData (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:142:21) at fetchFn (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:1124:10) at Object.one (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:1132:14) at file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:1597:146 at withAsyncContext (/var/www/html/nodemodules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:2547:19) at setup (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug_-D9DXkFt-.mjs:1597:52) at sfcmain.setup (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:1652:23) at callWithErrorHandling (/var/www/html/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:86:19)
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai Thats me output at Promise.then.result (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:101:19) at new Promise (<anonymous>) at asyncData.refresh.asyncData.execute (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:98:21) at initialFetch (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:139:40) at useAsyncData (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:142:21) at fetchFn (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:1124:10) at Object.one (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:1132:14) at file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug-D9DXkFt-.mjs:1597:146 at withAsyncContext (/var/www/html/nodemodules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:2547:19) at setup (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug_-D9DXkFt-.mjs:1597:52) at _sfcmain.setup (file:///var/www/html/frontend/.nuxt/prerender/chunks/build/...slug_-D9DXkFt-.mjs:1652:23) at callWithErrorHandling (/var/www/html/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:86:19)
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai can you not read out files?
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai Now i get following debug information
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai now i have that output ERROR (node:9167) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification. 1:57:53 PM at getAllowUnauthorized (node:internal/options:69:13) at Object.connect (node:_tls_wrap:1743:29) at Client.connect (node:internal/deps/undici/undici:2251:24) at socket (node:internal/deps/undici/undici:7570:29) at new Promise (<anonymous>) at connect (node:internal/deps/undici/undici:7569:30) at _resume (node:internal/deps/undici/undici:7718:11) at resume (node:internal/deps/undici/undici:7663:7) at Client.<computed> (node:internal/deps/undici/undici:7448:35) at [dispatch] (node:internal/deps/undici/undici:7489:24) ├─ /200.html (64ms) nitro 1:57:53 PM ├─ /404.html (66ms) nitro 1:57:53 PM ├─ / (287ms) nitro 1:57:53 PM │ └── [500]
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai i still get no error message when using prerendering. Errors prerendering: ├─ / (325ms) nitro 1:54:59 PM │ └── [500] nitro 1:54:59 PM ERROR Exiting due to prerender errors. 1:54:59 PM at prerender (/var/www/html/node_modules/nitropack/dist/core/index.mjs:2054:11) at async /var/www/html/node_modules/nuxt/dist/shared/nuxt.CrJjphBv.mjs:4266:5 at async build (/var/www/html/node_modules/nuxt/dist/shared/nuxt.CrJjphBv.mjs:6645:3) at async Object.run (/var/www/html/node_modules/@nuxt/cli/dist/chunks/build.mjs:74:5) at async runCommand (/var/www/html/node_modules/citty/dist/index.mjs:316:16) at async runCommand (/var/www/html/node_modules/citty/dist/index.mjs:307:11) at async runMain (/var/www/html/node_modules/citty/dist/index.mjs:445:7)
103 replies
NNuxt
Created by Samuelreichoer on 3/1/2025 in #❓・help
Prerendering not working
@kapa.ai Would you handle errors differently const { data, error } = await useCraftQuery('entries') .uri(uri.value) .site(currentSite.value.handle) .one() if (error.value) { throw createError({ statusCode: 500, statusMessage: 'Page Not Found' + error.value, }) } Use craft query is just a url builder and useasyncdata under the hood
103 replies