Ryan The Temp
Ryan The Temp
Explore posts from servers
NNuxt
Created by Ryan The Temp on 9/23/2024 in #❓・help
Which of these is the correct way to fetch?
When is the correct way to do a $fetch with parameters: A: data is: globalThis.Ref<unknown, unknown>
const { data } = await useAsyncData("project", () =>
$fetch(`/api/project/${id}`,
)
const { data } = await useAsyncData("project", () =>
$fetch(`/api/project/${id}`,
)
B: data is: globalThis.Ref<Simplify<SerializeObject<{..... /> (correct)
const { data } = await useAsyncData("project", () =>
$fetch(`/api/project/:id`, { params: { id } }),
)
const { data } = await useAsyncData("project", () =>
$fetch(`/api/project/:id`, { params: { id } }),
)
A works if I just cast everything to any, but I lose all types. B also works, but it looks weird that I have to have an :id and declare a params 😕
3 replies
NNuxt
Created by Ryan The Temp on 9/7/2024 in #❓・help
Type errors being thrown from `nuxt-content`
I'm not sure if this is nuxt-content related or not. It could be nuxt and/or vue, since both got a version bump. during nuxi typecheck I get these errors:
node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH6.vue:4:13 - error TS2339: Property 'id' does not exist on type 'CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, { generate: typeof generate; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 17 more ..., {}>'.

4 v-if="id && generate"
node_modules/@nuxtjs/mdc/dist/runtime/components/prose/ProseH6.vue:4:13 - error TS2339: Property 'id' does not exist on type 'CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, { generate: typeof generate; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 17 more ..., {}>'.

4 v-if="id && generate"
Looking at the source code for that file here: https://github.com/nuxt-modules/mdc/blob/main/src/runtime/components/prose/ProseH6.vue its pertty straight foward. I'm thinking is prop access like that not supported anymore?
1 replies
NNuxt
Created by Ryan The Temp on 7/3/2024 in #❓・help
`readBody` hangs
Hi, I have this code:
export default defineEventHandler(async (event) => {
const body = await readBody(event)

console.log("body: ", body)
return true
})
export default defineEventHandler(async (event) => {
const body = await readBody(event)

console.log("body: ", body)
return true
})
Is there any reason why code execution would hang at the readBody line indefinitely?
3 replies
NNuxt
Created by Ryan The Temp on 6/9/2024 in #❓・help
How to properly run local dev server using ssl
I configured my local dev server to use https like so:
devServer: {
host: 'app.local',
https: {
cert: './.certs/app.local.pem',
key: './.certs/app.local-key.pem',
},
},
devServer: {
host: 'app.local',
https: {
cert: './.certs/app.local.pem',
key: './.certs/app.local-key.pem',
},
},
Im now able to access my app locally using: https://app.local However, on the server, why does this return http?
export default defineEventHandler((event) => {
const redirectUrl = getRequestURL(event)

console.log('protocol', redirectUrl.protocol) // <-- 'http'
return
})
export default defineEventHandler((event) => {
const redirectUrl = getRequestURL(event)

console.log('protocol', redirectUrl.protocol) // <-- 'http'
return
})
Am I missing something?
1 replies
NNuxt
Created by Ryan The Temp on 5/23/2024 in #❓・help
How do you set the cookie domain?
I've setup a hosts entry for local development for app.local Now I'm running nuxt with nuxt dev --host app.local The problem is that when I use setCookie from h3 its still creating the cookie for the localhost domain. Is there a way to change this?
3 replies
NNuxt
Created by Ryan The Temp on 5/18/2024 in #❓・help
Build hangs after success
When Run nuxt build it seems to hang after it finishes. The last output is: #13 158.8 [success] [nitro] You can preview this build using node .output/server/index.mjs If I manually kill the process with CMD+C and run nuxt preview i'm able to run the built app. The problem is that in the CI environment, it would just hang forever and eventually timeout. Any idea what is the problem? Can turn on verbose logging to see what exactly is hanging on?
1 replies
NNuxt
Created by Ryan The Temp on 7/9/2023 in #❓・help
Build timeout during prerender step
No description
1 replies
NNuxt
Created by Ryan The Temp on 4/16/2023 in #❓・help
Is there a way to set a custom response header?
No description
2 replies