Archerist
Archerist
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
well this is outside of my knowledge sorry
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
so you have engine io server, socket io server, http server and nitro server all at the same time?
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
you can also check nginx logs to see whats up
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
status codes, nuxt errors, nginx errors
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
check the network tab
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
well you are gonna get the cors error if the clients get 4xx/5xx responses as well
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
you mean the whole request or just the headers?
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
oh nvm
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
well you are not sending your nginx conf or any code, so all i can do is guess
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
i mean it doesnt matter as long as you set the headers, if you set them in nuxt nginx will forward it straight, if you set them in nginx it will just add the headers to the response. output is gonna be the same, i think
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
just nginx should be fine
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
oh yea
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
i found this as an example
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
31 replies
NNuxt
Created by Rush on 7/25/2024 in #❓・help
Nuxt socket.io CORS error
im running an app behind reverse proxy as well, i dont remember setting anything specifically for cors
31 replies
NNuxt
Created by funk2351 on 7/25/2024 in #❓・help
Server middleware for specific route
also if i understand correctly you have vue components inside your pages folder. you should move them out of the pages folder and into components folder
5 replies
NNuxt
Created by funk2351 on 7/25/2024 in #❓・help
Server middleware for specific route
5 replies
NNuxt
Created by funk2351 on 7/25/2024 in #❓・help
Server middleware for specific route
well, server middlewares should be in server/middleware folder, aside from that you can easily do something like this:
export default defineEventHandler(async (event) => {
let URL = getRequestURL(event)
if (URL.pathname.startsWith("/foo/bar")) {
///Do stuff
}
}
export default defineEventHandler(async (event) => {
let URL = getRequestURL(event)
if (URL.pathname.startsWith("/foo/bar")) {
///Do stuff
}
}
5 replies
NNuxt
Created by Archerist on 7/25/2024 in #❓・help
Reading multiple files using readFormData
Function used in the front end to make the post request
async function save(row:any){
var data = new FormData()
for (let file of row.files) {
data.append("files[]", file)
}
data.append("audio", row.blob, `audio.${recorder.mimeType.split(';')[0].split('/')[1]}`)
try {

await $fetch("/api/save",{
method:"post",
body:data
})

} catch (ex) {
error.value= true
return
}
error.value=false

let index = rows.value.findIndex((r) => r.audio === row.audio) // r.audio is the url string
if (index > -1) {
rows.value.splice(index, 1);
}

}
async function save(row:any){
var data = new FormData()
for (let file of row.files) {
data.append("files[]", file)
}
data.append("audio", row.blob, `audio.${recorder.mimeType.split(';')[0].split('/')[1]}`)
try {

await $fetch("/api/save",{
method:"post",
body:data
})

} catch (ex) {
error.value= true
return
}
error.value=false

let index = rows.value.findIndex((r) => r.audio === row.audio) // r.audio is the url string
if (index > -1) {
rows.value.splice(index, 1);
}

}
3 replies
NNuxt
Created by Archerist on 7/25/2024 in #❓・help
Reading multiple files using readFormData
well, tried what i'd get if i used readMultipartFormData
export default defineEventHandler(async (event) => {
let body = await readMultipartFormData(event)
console.log(body)
})
export default defineEventHandler(async (event) => {
let body = await readMultipartFormData(event)
console.log(body)
})
#
# Fatal error in , line 0
# Fatal JavaScript invalid size error 169220804 (see crbug.com/1201626)
#
#
#
#FailureMessage Object: 0x7641729fa2f0
----- Native stack trace -----

1: 0x6452642e6357 [/usr/bin/node]
2: 0x64526504617a V8_Fatal(char const*, ...) [/usr/bin/node]
3: 0x645264664e3b [/usr/bin/node]
4: 0x64526481c350 [/usr/bin/node]
5: 0x645264828d04 [/usr/bin/node]
6: 0x645264a7de38 v8::internal::Runtime_GrowArrayElements(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
7: 0x645264eb5ef6 [/usr/bin/node]
#
# Fatal error in , line 0
# Fatal JavaScript invalid size error 169220804 (see crbug.com/1201626)
#
#
#
#FailureMessage Object: 0x7641729fa2f0
----- Native stack trace -----

1: 0x6452642e6357 [/usr/bin/node]
2: 0x64526504617a V8_Fatal(char const*, ...) [/usr/bin/node]
3: 0x645264664e3b [/usr/bin/node]
4: 0x64526481c350 [/usr/bin/node]
5: 0x645264828d04 [/usr/bin/node]
6: 0x645264a7de38 v8::internal::Runtime_GrowArrayElements(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
7: 0x645264eb5ef6 [/usr/bin/node]
3 replies