Git Product home page Git Product logo

Comments (15)

yanyanlongxia avatar yanyanlongxia commented on August 24, 2024 2

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

from nextjs-notion-starter-kit.

dbredvick avatar dbredvick commented on August 24, 2024 2

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.

from nextjs-notion-starter-kit.

minhthongdoan avatar minhthongdoan commented on August 24, 2024 2

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.

from nextjs-notion-starter-kit.

transitive-bullshit avatar transitive-bullshit commented on August 24, 2024 1

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.

from nextjs-notion-starter-kit.

transitive-bullshit avatar transitive-bullshit commented on August 24, 2024 1

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.

from nextjs-notion-starter-kit.

bcanata avatar bcanata commented on August 24, 2024 1

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.

from nextjs-notion-starter-kit.

dalaomai avatar dalaomai commented on August 24, 2024 1

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.

from nextjs-notion-starter-kit.

transitive-bullshit avatar transitive-bullshit commented on August 24, 2024 1

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.

from nextjs-notion-starter-kit.

yanyanlongxia avatar yanyanlongxia commented on August 24, 2024

I ran it locally by vercel dev and it turned it a 404 Error? Do you know what's wrong?

I've turned the domain into localhost

imag1.png

imag2.png

from nextjs-notion-starter-kit.

wujunchuan avatar wujunchuan commented on August 24, 2024

I post request manually, the response is success.

image

ps: But vercel dev mode, it doesn't work.

Update: I guess the server render step, the api server is not running yet?

I ran it locally by vercel dev and it turned it a 404 Error? Do you know what's wrong?

I've turned the domain into localhost

imag1.png

imag2.png

from nextjs-notion-starter-kit.

Tirth27 avatar Tirth27 commented on August 24, 2024

Hello @transitive-bullshit I am getting Firebase config error: invalid "GOOGLE_APPLICATION_CREDENTIALS" should be base64-encoded JSON

Did you have any guide to how to configure one.

Thank you in Advance.

from nextjs-notion-starter-kit.

Tirth27 avatar Tirth27 commented on August 24, 2024

Hi @dbredvick, Thank you for your response.

I have tried to follow your steps but it is still not working for me. I have provided the vercel for debugging.
vercel_deploy_logs.txt

Hope it helps.

from nextjs-notion-starter-kit.

YamenSharaf avatar YamenSharaf commented on August 24, 2024

Did anyone figure out a way around this? I'm also using a custom domain and when I run locally I'm getting the same 404 error and when deploying getting the teapot error

from nextjs-notion-starter-kit.

m0rtyn avatar m0rtyn commented on August 24, 2024

@Tirth27
Hi, it was helpful for me to find this instruction for getting Gcloud service credentials, not Firebase config object ⇾ https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account

@transitive-bullshit
I can add this link to README file

But when I solved the first problem, I faced with "status 418" error, and when I downgraded to node 12 then I get "Error occurred prerendering page" on pages with custom URLs from site.config.

So I don't know what to do to fix image previews 🤷‍♂️

My last build log with first of similar errors image

from nextjs-notion-starter-kit.

Dmitry-zh avatar Dmitry-zh commented on August 24, 2024

This message was prepared with the help of a translator, so I apologize in advance.

Firstly, I considered it right to wrap firebase API calls in a try catch construct (ib/get-preview-images.ts 21-24, 30)
Then the api/create-preview-image call was also wrapped in a try catch to get results and filter out nullable
This already solves the build problem if some image didn't load in firebase.

In the future, I plan to stop calling /api/create-preview-image. Since it requires an upstream server, it causes errors if the build runs on the same port.
Instead, 'create-preview-image' should be moved to lib and call the firebase API from there to load the image

from nextjs-notion-starter-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.