swift-cloud/Vercel

Internal server error running starter code

matthewcheok opened this issue · 3 comments

Trying this out for the first time and running into the following error in my console testing the server locally:

-------------------------------------------------------------------------
Running dev server: http://localhost:7676
-------------------------------------------------------------------------

  [0/1] Planning build
  Building for debugging...
  [0/3] Write swift-version-33747A42983211AE.txt
  Build complete! (0.65s)
  2024-08-19T14:08:58+0900 info LocalLambdaServer : [AWSLambdaRuntimeCore] LocalLambdaServer started and listening on 127.0.0.1:7000, receiving events on /invoke
  2024-08-19T14:08:58+0900 info Lambda : [AWSLambdaRuntimeCore] lambda runtime starting with LambdaConfiguration
  General(logLevel: info))
  Lifecycle(id: 268671518880625, maxTimes: 0, stopSignal: TERM)
  RuntimeEngine(ip: 127.0.0.1, port: 7000, requestTimeout: nil
  [2024-08-19T05:09:12.670Z] GET /
  Vercel/Environment.swift:31: Fatal error: Unexpectedly found nil while unwrapping an Optional value
  Error: socket hang up
    at connResetException (node:internal/errors:721:14)
    at Socket.socketOnEnd (node:_http_client:519:23)
    at Socket.emit (node:events:526:35)
    at endReadableNT (node:internal/streams/readable:1408:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'ECONNRESET'
}
  [2024-08-19T05:09:13.101Z] GET /favicon.ico
  SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Server.<anonymous> (/<project-root>/.build/checkouts/Vercel/Plugins/VercelPackager/Server/server.cjs:57:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  [2024-08-19T05:09:51.611Z] GET /
  SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Server.<anonymous> (/<project-root>/.build/checkouts/Vercel/Plugins/VercelPackager/Server/server.cjs:57:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

It looks like the edgeConfig might be missing - do I have to link the project with vercel before the server would work?

I tried running vercel link which initially failed because of

Error: Invalid request: `files` should NOT have more than 15000 items,

I got around that by duplicating .gitignore to .vercelignore but it didn't solve the above issue.

Ah nevermind, the file/line was incorrectly reported.
I copied the starter code which was failing...

let greeting = EdgeConfig.default.get("greeting").string!