Go serverless functons are crashing since nodejs v22

My go serverless functions used to work up until yesterday. Today with a new commit, during build it got this error saying nodejs v18 is depreciated. Then I changed nodejs version to v22 in settings. Now the functions are crashing because all environment variables are empty string “”

Environment variables must be accessible. Now it’s giving empty string “”

I tried logging all variables, all are now “”

https://api.openfiat.org/ public URL

Vercel.json -

{
    "$schema": "https://openapi.vercel.sh/vercel.json",
    "github": {
      "silent": true
    },
    "trailingSlash": false,
    "rewrites": [
      {
        "source": "/(.*)",
        "destination": "/api/vercel.go"
      }
    ],
    "functions": {
      "api/*.go": {
        "includeFiles": "secure-connect-openfiat-test.zip"
      }
    },
    "regions": ["bom1"]
  }

Golang script using the environment variables

    log.Println("ACCESS_TOKEN_DURATION", os.Getenv("ACCESS_TOKEN_DURATION"))
	log.Println("REFRESH_TOKEN_DURATION", os.Getenv("REFRESH_TOKEN_DURATION"))
	log.Println("DB_MIGRATE_UP", os.Getenv("DB_MIGRATE_UP"))

Errors log

2025/11/21 14:16:22 ACCESS_TOKEN_DURATION 
2025/11/21 14:16:22 REFRESH_TOKEN_DURATION 
2025/11/21 14:16:22 can not parse ACCESS_TOKEN_DURATION time: invalid duration ""
2025/11/21 14:16:22 can not load config:time: invalid duration ""

I have single serverless function /api/vercel.go which handles all routes. It is using /app/config in which env variables are accessesd. Everything used to work until we pushed an update yesterday.

@amyegan @swarnava @anthony-shew Any clue ?

have you tried echo ing env variable on build time and see if it prints the value?

But the variables are needed at function execution, not at build time. Anyway I’ll try this

If the variables are being printed in build time, they should be available in Runtime as well. If you can provide us a minimal repro, that would be great.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.