platforms
platforms copied to clipboard
Bug: Adding a custom domain with an initial misconfigured DNS config keeps staying in error mode forever
Issue
Under certain conditions, a custom domain never gets green in the UI. It's stuck in "Invalid Configuration".
The "verify" endpoint keeps returning an "Invalid Configuration". If you call the Vercel API manually via cURL it shows "misconfigured": false.
Steps to reproduce
- Add a custom domain
- Misconfigure the DNS settings for this domain
- See in the UI the "Invalid Configuration" error (or call the "verify" endpoint)
- Fix the DNS settings so they are correct
- In the UI you continue to see an "Invalid Configuration" (or call the "verify" endpoint)
Analysis
- The
verifyendpoint calls thegetConfigResponse. This function usesfetch
https://github.com/vercel/platforms/blob/29e20e790eaf17d4d5051c23a69636dce724c174/lib/domains.ts#L85-L96
- According to the documentation fetch is cached by default. In the file, neither a locale nor a global revalidate is configured.
=> Theory: The issue appears because the fetch in getConfigResponse is cached and never revalidated. Due to the initial misconfiguration, the function and hence the whole endpoint keeps returning an "Invalid Configuration".
A possible fix is to add a revalidation or turn off caching for this particular fetch.