nextjs-notion-starter-kit: HTTPError: Response code 418 (I'm a Teapot)

I want to enable preview image support, so I set up my firebase. But when I was deploying, Vercel told me


page load error {
--
11:18:07.713 | pageId: '123b34e0-320e-42a8-b02e-3af7553a2bbc',
11:18:07.713 | spaceId: 'f225ce83-48e1-4217-8126-c47ff80789dc'
11:18:07.713 | } HTTPError: Response code 418 (I'm a Teapot)
11:18:07.713 | at Request.<anonymous> (/vercel/workpath3/node_modules/got/dist/source/as-promise/index.js:117:42)
11:18:07.713 | at processTicksAndRejections (internal/process/task_queues.js:97:5) {
11:18:07.713 | code: undefined,
11:18:07.713 | timings: {
11:18:07.713 | start: 1612408687533,
11:18:07.713 | socket: 1612408687534,
11:18:07.713 | lookup: 1612408687558,
11:18:07.713 | connect: 1612408687569,
11:18:07.713 | secureConnect: 1612408687595,
11:18:07.713 | upload: 1612408687595,
11:18:07.713 | response: 1612408687710,
11:18:07.713 | end: 1612408687710,
11:18:07.713 | error: undefined,
11:18:07.713 | abort: undefined,
11:18:07.713 | phases: {
11:18:07.713 | wait: 1,
11:18:07.713 | dns: 24,
11:18:07.713 | tcp: 11,
11:18:07.713 | tls: 26,
11:18:07.713 | request: 0,
11:18:07.713 | firstByte: 115,
11:18:07.713 | download: 0,
11:18:07.714 | total: 177
11:18:07.714 | }
11:18:07.714 | }
11:18:07.714 | }

When I disabled the preview image support, it went back to normal.

This is the content in vercel.json imag1.png

Here is the information from firestore imag2.png

This is the firestore rule: imag3.png

The full Vercel output

Do you know what is wrong?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Hello @yanyanlongxia @Tirth27. In my case, it’s returning 418 error because the Node.js version in Vercel is 14.x. After going to the Vercel’s project setting, change Node.js version to 12.x, the error disappears and preview image support works flawlessly.

Okay, a few common causes of this:

  1. Your URL is set to the wrong address in site.config.js
  2. Your deployed API function is set to isPreviewImageSupportEnabled: false
  3. ?? not sure if in build the localhost:3000/api/generate works??

A few quick fixes:

  1. set isPreviewImageSupportEnabled: true
  2. comment out lines 48-50 of notion.ts (the image stuff)
  3. deploy it

Then after that deployment finishes,

  1. uncomment out lines 48-50
  2. set the site domain in site.config.js to the output of your Vercel build (e.g. blog-drab-alpha.vercel.app)
  3. deploy again

That path fixed everything for me. Am going to look further into the root cause later.

Also, after I disabled preview image support, it went back to normal.

There is also an error message Error! Failed to complete request to /_next/webpack-hmr?page=%2F: Error: socket hang up

The latest version has switched to using a much simpler approach for image caching, and this API route no longer exists.

Please upgrade to the latest to fix this issue.

it look like about custom domain.when i remove my domain in Vercel, everything ok !! If i use my domain will get 418. if i use my domain in Vercel but set vercel’s domain in .site.config will get 500. After a few attempts, i think need change Node.js version to 12.x and set vercel’s domain in .site.config.

I’m also getting:

00:02:24.382 | page error xxx.yyy HTTPError: Response code 418 (I'm a Teapot)
-- | --
00:02:24.382 | at Request.<anonymous> (/vercel/workpath2/node_modules/got/dist/source/as-promise/index.js:117:42)
00:02:24.383 | at processTicksAndRejections (internal/process/task_queues.js:93:5) {

My token json file is base64 encoded and correct. If I mistype it, I receive:

Firebase config error: invalid "GOOGLE_APPLICATION_CREDENTIALS" should be base64-encoded JSON

So the 418 error is caused by another problem, I guess.

If you’re on macOS, you can run:

cat my-google-application-credentials-file.json | base64 | pbcopy

And the result will be in your clipboard.

I think this error is coming from here: https://github.com/transitive-bullshit/nextjs-notion-starter-kit/blob/main/api/create-preview-image.ts#L19

If you add your env variables into a local .env.build file (maybe also a .env file which is what I do), and then run vercel dev, does it work for you locally?

My advice is to try getting the preview images working locally before deploying to vercel.