Vercel部署Nuxt调用Octokit出现ERR_OSSL_UNSUPPORTED错误求助
GitHub App部署Vercel后Octokit私钥解码错误排查
使用Nuxt框架(Nitro作为后端)开发GitHub App安装回调接口,功能是将用户数据导入数据库。该GitHub App部署在Vercel平台,本地私钥配置方式与生产环境一致,且已多次验证密钥有效性,推测问题与Octokit相关。
生产环境配置
- Node.js
^20
触发错误的代码
const { data: installation } = await octokit.rest.apps.getInstallation({ installation_id: installationId })
生产环境错误日志
Error: error:1E08010C:DECODER routines::unsupported at createPrivateKey (node:internal/crypto/keys:632:12) at convertPrivateKey (file:///var/task/node_modules/universal-github-app-jwt/lib/crypto-node.js:11:10) at getToken (file:///var/task/node_modules/universal-github-app-jwt/lib/get-token.js:19:31) at githubAppJwt (file:///var/task/node_modules/universal-github-app-jwt/index.js:32:23) at getAppAuthentication (file:///var/task/node_modules/@octokit/auth-app/dist-node/index.js:14:37) at hook (file:///var/task/node_modules/@octokit/auth-app/dist-node/index.js:315:37) at async requestWithGraphqlErrorHandling (file:///var/task/node_modules/@octokit/plugin-retry/dist-bundle/index.js:36:20) at async Job.doExecute (/var/task/node_modules/bottleneck/light.js:405:18) { library: 'DECODER routines', reason: 'unsupported', code: 'ERR_OSSL_UNSUPPORTED' }
已尝试的解决方案
- 配置环境变量
NEPTUN_GITHUB_APP_PRIVATE_KEY为带引号的私钥字符串,或添加换行符转义格式 - 在代码中使用
process.env.NEPTUN_GITHUB_APP_PRIVATE_KEY?.replace(/\n/g, '\n')处理换行 - 设置环境变量
NODE_OPTIONS=--openssl-legacy-provider
补充:设置legacy provider后的崩溃日志
Unable to load legacy provider. # node[3]: v8::Maybe<bool> node::crypto::CipherJob<CipherTraits>::ToResult(v8::Local<v8::Value>*, v8::Local<v8::Value>*) [with CipherTraits = node::crypto::AESCipherTraits] at ../src/crypto/crypto_cipher.h:262 # Assertion failed: errors->Empty() ----- Native stack trace ----- 1: 0x55e379de39ac node::Assert(node::AssertionInfo const&) [node] 2: 0x55e379f7f77c node::crypto::CryptoJob<node::crypto::AESCipherTraits>::AfterThreadPoolWork(int) [node] 3: 0x55e37ab42fc9 [node] 4: 0x55e37ab48193 [node] 5: 0x55e37ab60b73 [node] 6: 0x55e37ab49227 uv_run [node] 7: 0x55e379cd4146 node::SpinEventLoopInternal(node::Environment*) [node] 8: 0x55e379e3b3f6 [node] 9: 0x55e379e3bf5c node::NodeMainInstance::Run() [node] 10: 0x55e379d920c3 node::Start(int, char**) [node] 11: 0x7fb593021eb0 [/lib64/libc.so.6] 12: 0x7fb593021f60 __libc_start_main [/lib64/libc.so.6] 13: 0x55e379cd1465 _start [node] Node.js process exited with signal: 6 (SIGABRT). The logs above can help with debugging the issue.
已参考相关问题但未解决,恳请协助排查问题根源及可行解决方案。
内容的提问来源于stack exchange,提问作者ihaveaquestion
相关产品推荐
相关产品推荐

