K-Phoen / backstage-plugin-announcements

Announcements plugin for Backstage
MIT License
52 stars 30 forks source link

bug: attempting to create an announcement without a body throws 500 error #172

Closed kurtaking closed 1 year ago

kurtaking commented 1 year ago

Summary

A user will receive a 500 error when attempting to create an announcement with an empty body.

Details

image
Request failed with status 500 insert into "announcements" ("body", "created_at", "excerpt", "id", "publisher", "title") values ($1, $2, $3, $4, $5, $6) - null value in column "body" of relation "announcements" violates not-null constraint dd=[object Object] type=errorHandler pz=unknown env=unknown stage=unknown cluster=unknown length=308 name=error severity=ERROR code=23502 detail=Failing row contains (ef6e1602-513b-4a9d-aece-28b83416f73b, user:default/user, test, test, null, 2023-06-12 21:46:52.768+00). hint=undefined position=undefined internalPosition=undefined internalQuery=undefined where=undefined schema=public table=announcements column=body dataType=undefined constraint=undefined file=execMain.c line=1883 routine=ExecConstraints stack=error: insert into "announcements" ("body", "created_at", "excerpt", "id", "publisher", "title") values ($1, $2, $3, $4, $5, $6) - null value in column "body" of relation "announcements" violates not-null constraint

Solutions

  1. Make the field required
  2. Fix to allow for an empty body
K-Phoen commented 1 year ago

Haha, yeaaaaaahhhh... I'm aware of this :D

What can I say, trivial bugs are sometimes around for much longer than they should :D