首页 > 解决方案 > 现在进行 ssr get 调用时出现 NO_STATUS_CODE_FROM_LAMBDA 错误

问题描述

我正在 now.sh 上运行一个 nuxt 通用应用程序,这使得 ssr 可以调用其他地方的https://getcockpit.com/服务器。当我打开应用程序时,出现代码“NO_STATUS_CODE_FROM_LAMBDA”的 502 错误。

在本地运行它或将其部署为水疗中心而不是通用应用程序工作得很好,因为那时调用不是由 lambda 发出的,而是来自我的机器我猜。根据它的日志,我运行 getcockpit-cms 的网络服务器从现在开始没有收到任何呼叫,因此问题似乎不在这方面。

now.sh 日志对我来说真的没什么。我发现的唯一一件事是“在完成请求之前感到兴奋”,但这对我也没有帮助。

'XSRF-TOKEN',
     xsrfHeaderName: 'X-XSRF-TOKEN',
     maxContentLength: -1,
     validateStatus: [Function: validateStatus],
     data: undefined },
  request: 
   Writable {
     _writableState: 
      WritableState {
        objectMode: false,
        highWaterMark: 16384,
        finalCalled: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        destroyed: false,
        decodeStrings: true,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function: bound onwrite],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false,
        bufferedRequestCount: 0,
        corkedRequestsFree: [Object] },
     writable: true,
     domain: null,
     _events: { response: [Function], error: [Function] },
     _eventsCount: 2,
     _maxListeners: undefined,
     _options: 
      { protocol: 'http:',
        maxRedirects: 21,
        maxBodyLength: 10485760,
        path: '/api/singletons/get/intro',
        method: 'GET',
        headers: [Object],
        agent: undefined,
        auth: undefined,
        hostname: 'localhost',
        port: '3000',
        nativeProtocols: [Object],
        pathname: '/api/singletons/get/intro' },
     _redirectCount: 0,
     _redirects: [],
     _requestBodyLength: 0,
     _requestBodyBuffers: [],
     _onNativeResponse: [Function],
     _currentRequest: 
      ClientRequest {
        domain: null,
        _events: [Object],
        _eventsCount: 6,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: true,
        upgrading: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: 0,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [Object],
        connection: [Object],
        _header: 'GET /api/singletons/get/intro HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nx-real-ip: 5.149.20.127\r\nsec-fetch-user: ?1\r\nsec-fetch-site: none\r\nupgrade-insecure-requests: 1\r\ncache-control: no-cache\r\nx-now-trace: zrh1\r\nx-now-deployment-url: BLURRED-NOW-DEPLOYMENT-URL\r\nx-zeit-co-forwarded-for: 5.149.20.127\r\naccept-language: en-GB,en-US;q=0.9,en;q=0.8,de;q=0.7\r\nx-forwarded-proto: https\r\nsec-fetch-mode: navigate\r\nx-forwarded-for: 5.149.20.127\r\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36\r\naccept-encoding: gzip, deflate\r\nx-now-id: clckl-1566116017296-db7c5240b52c\r\npragma: no-cache\r\nx-forwarded-host: BLURRED-NOW-DEPLOYMENT-URL\r\nconnection: close\r\nAuthorization: Bearer BLURRED-API-KEY\r\nHost: localhost:3000\r\n\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Object],
        socketPath: undefined,
        timeout: undefined,
        method: 'GET',
        path: '/api/singletons/get/intro',
        _ended: false,
        res: null,
        aborted: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        _redirectable: [Circular],
        [Symbol(outHeadersKey)]: [Object] },
     _currentUrl: 'http://localhost:3000/api/singletons/get/intro' },
  response: undefined,
  isAxiosError: true,
  toJSON: [Function] }
END RequestId: 5153a263-0ac9-4bf5-9c7d-4422783386ba
REPORT RequestId: 5153a263-0ac9-4bf5-9c7d-4422783386ba  Duration: 234.13 ms Billed Duration: 300 ms     Memory Size: 3008 MB    Max Memory Used: 97 MB  
RequestId: 5153a263-0ac9-4bf5-9c7d-4422783386ba Process exited before completing request


START RequestId: f32bcba9-aea6-46d0-9269-c0544a211fff Version: $LATEST
2019-08-18T08:13:39.117Z    f32bcba9-aea6-46d0-9269-c0544a211fff    λ Cold start took: 339.379719ms
END RequestId: f32bcba9-aea6-46d0-9269-c0544a211fff
REPORT RequestId: f32bcba9-aea6-46d0-9269-c0544a211fff  Duration: 115.83 ms Billed Duration: 200 ms     Memory Size: 3008 MB    Max Memory Used: 53 MB  

我希望 now.sh 或者更确切地说是 lambda 来拨打电话并 ssr 我的应用程序。

标签: vue.jsaws-lambdanuxt.jsvercelcockpit-cms

解决方案


推荐阅读