#request.formData: Could not parse content as FormData

18 messages · Page 1 of 1 (latest)

onyx wolf
#

I'm trying to follow a guide for inserting data into AstroDB and the example is failing with "request.formData: Could not parse content as FormData".

Other posts on here suggest this might have something to do with SSR. I've tried adding export const prerender = false; to the top of the file but it doesn't change anything.

Kind of at a loss here. This seems like a pretty simple thing that should just work.

glossy raft
#

Did the example code not work? May need more details about your code to find out

onyx wolf
#

Here is what I am running and the error message

wooden crag
#

What is your site output? Is it static?

onyx wolf
#

Hmm I have not configured anything related to SSR or added any adapters for that.

#

It's just a stock Astro project

#

I'm not sure why I would need to set all of that up just to write to the AstroDB. I guess this is more of a docs issue at this point. I think I can figure out how to write to AstroDB without relying on these custom functions

analog raptor
#

Prerequisites

A project with SSR (output: 'server') enabled
analog raptor
#

Writing to the DB is not related to the form

onyx wolf
#

Yeah that prereq is on a wholly different docs page than the one that has this example for AstroDB :/

analog raptor
#

Well to clarify, the issue you are having here is trying to use an HTML form on a non SSR page, it has nothing to do with Astro DB

onyx wolf
#

Thanks

analog raptor
#

I recommend Actions for handling your forms personally, you can set them all up in an index file and just call them with a simple function client side 😄

https://docs.astro.build/en/guides/actions/

Docs

Learn how to create type-safe server functions you can call from anywhere.

analog raptor
onyx wolf
analog raptor
#

Ah no worries my friend, we've all been there! ❤️