What nobody's mentioning is that sometimes the problem comes from your Nintendo profile not being properly linked to your online account. Go to Console Settings > Accounts > Your Account > Link Nintendo Account and make sure everything's connected correctly. If it's linked but still not working, unlink it and link it again. That usually fixes it when privacy settings have nothing to do with it.
Also pay attention to this: go to Settings > Users and Profiles > Your Profile > Privacy Settings, and then look for the option that says something like "Show your online activity to your friends." That needs to be explicitly turned on, and sometimes when you update the console or change other settings it gets turned off without you noticing. It's not enough to have the connection allowed in general; presence has to be specifically enabled in that menu.
If it's still not working after that, before you assume it's a server issue, try connecting to a different network if you can (like using your phone as a hotspot, for example) to rule out whether it's your WiFi or router. Sometimes there are weird incompatibilities and the Switch just doesn't sync well with certain routers, so switching networks for a few minutes will tell you if that's the problem or not.