Since HTTP is already reaching Vercel but HTTPS fails and the dashboard still says Invalid Configuration, I’d double-check the records that can block SSL provisioning rather than the app itself.
For the apex domain, the A record should match exactly what Vercel shows in the Domains dashboard. For www, the CNAME should also match exactly, including any trailing . if your DNS provider requires it. Also make sure there are no AAAA records pointing somewhere else, because Vercel’s troubleshooting docs note that IPv6/AAAA records are not supported for third-party DNS custom domains.
If you have any CAA records, make sure they allow Let’s Encrypt / Vercel to issue the certificate. Vercel lists CAA records as one of the common reasons SSL generation can fail.
If those commands show only the expected Vercel records and no conflicting AAAA/blocking CAA, then this is more likely stuck SSL/domain verification on Vercel’s side rather than a Next.js or deployment issue.