deno-playground icon indicating copy to clipboard operation
deno-playground copied to clipboard

Error: Error: Column 'todo' cannot be null

Open gaodun2016 opened this issue 2 years ago • 6 comments

http://localhost:8080/todos

{ "todo":"吃饭" }

{ "success": false, "message": "Error: Error: Column 'todo' cannot be null" }

The same code as the author, Why does the error message keep coming up?

gaodun2016 avatar Feb 14 '23 06:02 gaodun2016

0zm512234a7645m8h4023

gaodun2016 avatar Feb 14 '23 06:02 gaodun2016

I encountered the same problem. There is an error in the code for the POST section:

const body = await request.body();

should be

const body = await request.body().value;

Changing that fixed it for me. Wasted a lot of my time!

Stokestack avatar Sep 12 '23 00:09 Stokestack

@Stokestack thank you for pointing this out, this tutorial was created using Deno version 1.0.2 & it has since been updated. I don't want to update it to new version code here because then people who are coming from the article https://www.freecodecamp.org/news/create-a-todo-api-in-deno-written-by-a-guy-coming-from-node/ will get confused to see conflicting code.

adeelibr avatar Oct 07 '23 19:10 adeelibr

You're welcome. How about putting a comment in the code with the updated syntax then, right above or under the current one?

Stokestack avatar Oct 07 '23 20:10 Stokestack

You're welcome. How about putting a comment in the code with the updated syntax then, right above or under the current one?

doing that now 👍 @Stokestack

adeelibr avatar Oct 07 '23 20:10 adeelibr

A new section has been added in the README.me for this repository https://github.com/adeelibr/deno-playground#troubleshoot

Thanks for pointing this out @gaodun2016 @Stokestack

adeelibr avatar Oct 07 '23 20:10 adeelibr