You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Vercel Serverless Function崩溃排查:SvelteKit GraphQL请求异常

问题:Vercel Serverless Functions 随机崩溃(ECONNRESET)

页面初始加载时频繁出现随机错误,网站显示**"This Serverless Function has crashed"**错误:
Serverless Function崩溃错误截图

Vercel完整错误日志

[GET] /
14:54:19:39
2022-07-21T12:54:19.426Z    3a175b6b-396b-45d5-b1a1-46072201cd6a    ERROR   Unhandled Promise Rejection     
{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"FetchError: request to https://api-eu-central-1.graphcms.com/v2/cl2k6hi1809a401xk4hd3h5zj/master failed, reason: Client network socket disconnected before secure TLS connection was established","reason":{"errorType":"FetchError","errorMessage":"request to https://api-eu-central-1.graphcms.com/v2/cl2k6hi1809a401xk4hd3h5zj/master failed, reason: Client network socket disconnected before secure TLS connection was established","code":"ECONNRESET","message":"request to https://api-eu-central-1.graphcms.com/v2/cl2k6hi1809a401xk4hd3h5zj/master failed, reason: Client network socket disconnected before secure TLS connection was established","type":"system","errno":"ECONNRESET","stack":["FetchError: request to https://api-eu-central-1.graphcms.com/v2/cl2k6hi1809a401xk4hd3h5zj/master failed, reason: Client network socket disconnected before secure TLS connection was established","    at ClientRequest.<anonymous> (/var/task/index.js:7892:18)","    at ClientRequest.emit (node:events:527:28)","    at TLSSocket.socketErrorListener (node:_http_client:454:9)","    at TLSSocket.emit (node:events:527:28)","    at emitErrorNT (node:internal/streams/destroy:157:8)","    at emitErrorCloseNT (node:internal/streams/destroy:122:3)","    at processTicksAndRejections (node:internal/process/task_queues:83:21)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: FetchError: request to https://api-eu-central-1.graphcms.com/v2/cl2k6hi1809a401xk4hd3h5zj/master failed, reason: Client network socket disconnected before secure TLS connection was established","    at process.<anonymous> (file:///var/runtime/index.mjs:775:15)","    at process.emit (node:events:539:35)","    at emit (node:internal/process/promises:140:20)","    at processPromiseRejections (node:internal/process/promises:274:27)","    at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}[ERROR] [1658408059427] LAMBDA_RUNTIME Failed to post handler success response. Http response code: 400.RequestId: 2a0597b4-6684-4f2a-a724-2333b4f9332d Error: Runtime exited with error: exit status 128Runtime.ExitError

SvelteKit端点示例代码

import {client} from '$lib/js/graphql-client'
import {projectsQuery} from '$lib/js/graphql-queries'

export async function get() {
        let sm = 640;
        let md = 768;
        let lg = 1024;
        let xl = 1280;
        let xxl = 1536;
        
        const variables = {sm, md, lg, xl, xxl}

        const {projects} = await client.request(projectsQuery, variables) 

        return {
            body: {
                projects, sm, md, lg, xl, xxl
            }
        }
}

相关背景

已有其他开发者遇到同类问题,问题根源指向AWS Lambda(Vercel Serverless Functions基于AWS Lambda运行)。

需求

  • 确认该问题是否由Vercel Serverless Functions/AWS Lambda网络层面问题导致,而非代码逻辑错误
  • 寻求可行的规避方案,降低函数崩溃概率

内容的提问来源于stack exchange,提问作者Koen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 13:15:37