NuxtJS primisic generate fails to init Prismic API, preventing app fatal error

Hi all,

It seems that this topic has been raised several times. I'm having quite serious inconsistencies when i run a generate command for static pages with nuxt. Sometimes they work fine and my /blog/slug static pages get generated correctly and successfully.

However, without any code changes, sometimes when I run it, I received the following error

 ERROR  Failed to init Prismic API, preventing app fatal error.                            23:26:10


 ERROR  request to https://<REPO NAME>.cdn.prismic.io/api/v2?routes=%5B%7B%22type%22%3A%22post%22%2C%22path%22%3A%22%2Fblog%2F%3Auid%22%7D%5D failed, reason: write EPROTO 4534230528:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:


  
  at ClientRequest.<anonymous> (node_modules/node-fetch/lib/index.js:1461:11)
  at ClientRequest.emit (events.js:311:20)
  at ClientRequest.EventEmitter.emit (domain.js:482:12)
  at TLSSocket.socketErrorListener (_http_client.js:426:9)
  at TLSSocket.emit (events.js:311:20)
  at TLSSocket.EventEmitter.emit (domain.js:482:12)
  at errorOrDestroy (internal/streams/destroy.js:108:12)
  at onwriteError (_stream_writable.js:462:5)
  at onwrite (_stream_writable.js:483:5)
  at internal/streams/destroy.js:50:7
  at TLSSocket.Socket._destroy (net.js:673:5)
  at TLSSocket.destroy (internal/streams/destroy.js:38:8)
  at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:93:12)

I seem to get this error thrown many time during the generate process (I'm generating many other pages, but not using the prismic API for those), so I'm wondering if this is interfering with the build of other pages?

Edit: I realized I'm making over 40,000 API calls when I'm only generating 3-4 static pages... Why is the API over-called everytime? Is this related to If Prismic endpoint is not available then complete website is down · Issue #77 · nuxt-community/prismic-module · GitHub ?

This is quite serious because it fails to generate the static pages, resulting in a build failure. Seek your advice and help on this please...

It seems this was answered on Github: