83inc
Amateur Looking for Help Making POST to MySQL Using Nuxt 3
I come from a heavy product management, design and marketing background and have recently been able to brute-force my way through creating a simple form page using Nuxt 3/Vue 3/Tailwind/Pinia with Vercel for deployment and just set up a Digital Ocean MySQL database.
I've managed to accomplish a lot and I absolutely love everything about Nuxt/Vue and coming from a Figma background, Tailwind was especially fast to learn. I've got Pinia working but am now stuck on getting that data into my new DB.
So the flow is:User lands on my Form0001.vue form component. The userStore.js Pinia store is initialized and the useHandleVisitor.js composable is imported. (See attachment for code.)
This create a UUID which im using as the primary key in the MySQL table. Now, as the user fills out the form, the SaveVisitorData function is sending this data to the save-visitor-data.js endpoint in server/api. (See attachment for code.)
The issue is that I can see the endpoint being called in network. I see a 200 code, but the response is:
{success: false, error: "Cannot convert object to primitive value",…}
error: "Cannot convert object to primitive value"
stack: "Error: Cannot convert object to primitive value\n at PromisePool.query
success: false
I can't seem to figure this one out. Any ideas one what I'm doing wrong?
2 replies