It works fine.
This could be caused be thousands of reasons, but it’s not the code.
Make sure the Area2D is set to Pickable.
Make sure your Collision is properly set.
And next time post more info.
I fixed this my own by replacing root node from Container to Node2D.
The CollisionObject2D events not working if we place any control object (Container, Panel, TextureRect, etc.) as root node (I don’t know the reason but it was worked well in Godot 2).
Edit 1:
As instructed by literalcitrus mouse_filter = MOUSE_FILTER_IGNORE
fixed the issue without changing the type of root container.
The Container was eating the events and never reached the Area, look at input events in the documentation to see how that works.