By standard rules of 5e, many spells cannot target objects such as Sacred flame or Eldritch blast, This is very unintuitive and can lead to confusion. So these are the rules for objects The DM will define if your spell can hit an object, the ruling will be made when the spell is used from the first time when a situation like this shows up and then is added to the list below.

Spell

Ruling:

Eldritch Blast

Can hit objects, affects objects

Ray of Frost

Can hit objects, affects objects

Frostbite

Cannot affect objects

Sacred Flame

Can hit objects, affects objects

Magic Missile

Cannot hit objects, exclusively hones in on creatures.

Players can ask a DM beforehand what the ruling is, to make sure there's no in-game delays.

Things of note:

  • Objects now have a "Toughness" level, which can reduce damage by a fixed amount.

  • Objects automatically fail STR and DEX saves, taking full damage.

  • Objects automatically fail CON, WIS, INT and CHA saves, but take zero damage from it.