相关文章推荐
任性的紫菜汤  ·  Tools for Revit | 免费 ...·  8 月前    · 
不羁的围巾  ·  ASCII 函数 - Amazon ...·  1 年前    · 
踢足球的筷子  ·  html 时间控件 ...·  1 年前    · 
酒量小的柳树  ·  Java-Net·  2 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams
[GET] /proizvodi/9?fbclid=PAAaY2n3yQfX-Wzxs5pTMWeP9nMUkdIv2V4qg8kObIDQgUAdPnwLtWEr4ICYg_aem_AT5iXQ0y2WTFTVjFAkqIfOf-vx44GuIUXoJKxT5IunSH48Cf1QVjlfC8Q1rKapxuuR9daAL70GWwpLZ_rINriwy815oEYfwfXFvOuh3HvHBvhWRFkVdfeQom7PK6UZvTp0s
02:39:09:44
2023-01-26T01:39:09.507Z    f0d6641c-416c-4c0a-ba67-c59890f6f936    ERROR   [2023-01-26T01:39:09.507Z]  @firebase/firestore: Firestore (9.15.0): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
2023-01-26T01:39:09.539Z    efb98c51-3cde-4791-981f-5d22145fe3c0    ERROR   Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: fetch failed","reason":{"errorType":"TypeError","errorMessage":"fetch failed","cause":{"errorType":"Error","errorMessage":"Client network socket disconnected before secure TLS connection was established","code":"ECONNRESET","host":"translate.googleapis.com","port":443,"localAddress":null,"stack":["Error: Client network socket disconnected before secure TLS connection was established","    at connResetException (node:internal/errors:711:14)","    at TLSSocket.onConnectEnd (node:_tls_wrap:1593:19)","    at TLSSocket.emit (node:events:525:35)","    at endReadableNT (node:internal/streams/readable:1359:12)","    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"]},"stack":["TypeError: fetch failed","    at fetch (/var/task/node_modules/undici/index.js:105:13)","    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: fetch failed","    at process.<anonymous> (file:///var/runtime/index.mjs:1194:17)","    at process.emit (node:events:525:35)","    at emit (node:internal/process/promises:149:20)","    at processPromiseRejections (node:internal/process/promises:283:27)","    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]}
Unknown application error occurred
Runtime.Unknown

App works perfectly on the localhost, but on when deployed to vercel, I am getting these functions crashes now and then, seems like it's random. It's happening on all urls.

This is really a bummer since it's an e-commerce website and it's ruining my conversion rate.enter image description here

I tried changing the adapter in svelte.config.js to @sveltejs/adapter-vercel hoping it would work but to no avail.

Vercel uses cloud functions which lose web socket connections when they are frozen (as they are after a few minutes of not running). To ensure it works you can create a new connection for each request (so inside load function or GET function).

// $lib/firebase.js
import { initializeApp } from "firebase/app";
const firebaseConfig = {
   // FIREBASE_CONFIGURATION
export const getFirebaseApp = () => initializeApp(firebaseConfig);
// src/routes/example/+page.server.ts
import { getFirestore } from "firebase/firestore";
import { getFirebaseApp } from "$lib/firebase";
export const load = async ({ params, url }) => {
  const app = getFirebaseApp();
  const db = getFirestore(app);
  // use database and give a response

Another idea is would be to use @google-cloud/firestore serverside instead of @firebase/firestore because it is specifically for the backend (see this tutorial).

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.