Error when deploying to Vercel, API ref not found

Error when deploying to Vercel. In the development environment, the project is running normally and is being built, however, when deploying, it presents this error below:

Done in 0.53s.
14:44:33.367 Detected Next.js version: 14.0.3
14:44:33.372 Running "yarn run build"
14:44:33.550 yarn run v1.22.17
14:44:33.575 $ next build
14:44:34.516 ▲ Next.js 14.0.3
14:44:34.516
14:44:34.517 Creating an optimized production build ...
14:44:40.386 ✓ Compiled successfully
14:44:40.387 Linting and checking validity of types ...
14:44:42.462 Collecting page data ...
14:44:44.080 Generating static pages (0/18) ...
14:44:44.959 F [Error]: Ref not found. Ensure you have the correct ref and try again. Master ref is: ZX0RABAAACAAEjjQ
14:44:44.959 at N.fetch (/vercel/path0/.next/server/chunks/654.js:1:13020)
14:44:44.959 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
14:44:44.959 at async N.getFirst (/vercel/path0/.next/server/chunks/654.js:1:6221)
14:44:44.959 at async N.getSingle (/vercel/path0/.next/server/chunks/654.js:1:7197)
14:44:44.959 at async c (/vercel/path0/.next/server/chunks/353.js:1:6405) {
14:44:44.960 url: 'https://lucasmendes.cdn.prismic.io/api/v2/documents/search?q=[[at(document.type%2C+"404")]]&pageSize=1&ref=ZXm6dxAAACYAaGg3&routes=[{"type"%3A"home"%2C"path"%3A"%2F"}%2C{"type"%3A"todos_os_projetos"%2C"path"%3A"%2Fprojetos"}%2C{"type"%3A"todos_os_projetos"%2C"path"%3A"%2Fprojetos"}%2C{"type"%3A"sobre"%2C"path"%3A"%2Fsobre"}%2C{"type"%3A"contato"%2C"path"%3A"%2Fcontato"}%2C{"type"%3A"politica_privacidade"%2C"path"%3A"%2Fpolitica-privacidade"}%2C{"type"%3A"projeto"%2C"path"%3A"%2Fprojetos%2F%3Auid"}]&access_token=MC5aVzVnV0JFQUFDTUFLcDE1.M--_vT0z77-977-977-9U--_ve-_vTofURA8Nj4N77-977-977-9CU_vv71iGiFYYk7vv73vv70',
14:44:44.960 response: {
14:44:44.960 type: 'api_notfound_error',
14:44:44.960 message: 'Ref not found. Ensure you have the correct ref and try again. Master ref is: ZX0RABAAACAAEjjQ'
14:44:44.960 }
14:44:44.960 }

Hi Luiz,

It sounds like this issue. Can you check if the solution works for you:

I managed to resolve it, apparently it wasn't caching, but rather some change in the API token, I don't know if it was my client who made the change or someone on his team, but apparently it was because of this.

1 Like