开发者社区 > 云原生 > 正文

自定义容器应用,SpringBoot 服务,请求一直报:不支持当前媒体类型:Content type

自定义容器应用,SpringBoot 服务,请求一直报:不支持当前媒体类型:Content type 'application/octet-stream' not supported。 HTTP/1.1 502 Bad Gateway Access-Control-Expose-Headers: Date,x-fc-request-id,x-fc-error-type,x-fc-code-checksum,x-fc-invocation-duration,x-fc-max-memory-usage,x-fc-log-result,x-fc-invocation-code-version Content-Length: 114 Content-Type: application/json Date: Mon, 10 Oct 2022 03:33:28 GMT X-Fc-Error-Type: UnhandledInitializationError X-Fc-Instance-Id: c-634391e9-f93e98fff88d4e74bc0f X-Fc-Invocation-Duration: 7 X-Fc-Invocation-Service-Version: LATEST X-Fc-Max-Memory-Usage: 507.43 X-Fc-Request-Id: cca6ea43-aaf0-4794-8562-76485f87ddad

{ "errorMessage": "Process exited unexpectedly before completing request (duration: 6ms, maxMemoryUsage: 507.43MB)" }

展开
收起
云上静思 2022-10-10 18:00:56 1236 0
1 条回答
写回答
取消 提交回答
    1. 函数本身逻辑有问题, 导致执行环境退出

    2. 调用函数的 client 端主动 cancel 导致, 比如函数的执行时长是10s, 但是client 端(比如 sdk)调用函数自己的设置的 timeout 是 5s; 这里建议调用函数的 client 端的 timeout 要稍稍大于函数设置的 timeout

    3. 如果是custom runtime 出现这种情况, 最有可能是因为实现的 custom runtime 的 http server 没有文档中的第3个条件: connection 最好设置为 keep alive,请求超时时间至少设置在 15 分钟以上

    比如 nodejs express: nodejs var server = app.listen(PORT, HOST); server.timeout = 0; // never timeout server.keepAliveTimeout = 0; // keepalive, never timeout

    
    此答案来自钉钉群“阿里函数计算官网"
    2022-10-10 20:37:03
    赞同 展开评论 打赏

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关电子书

更多
阿里云文件存储 NAS 在容器场景的最佳实践 立即下载
何种数据存储才能助力容器计算 立即下载
《容器网络文件系统CNFS》 立即下载