vercel: [Bug] Vercel failed to build go serverless functions with go >= 1.21

Currently, vercel fails to build any golang serverless functions when using go1.21 or later, it outputs:

go: module . listed in go.work file requires go >= 1.21, but go.work lists go 1.18; to update it:
        go work use
go: module ../../../.. listed in go.work file requires go >= 1.21, but go.work lists go 1.18; to update it:
        go work use
Error: Command failed: go build -ldflags -s -w -o ./vercel-dev-server-go ./...
go: module . listed in go.work file requires go >= 1.21, but go.work lists go 1.18; to update it:
        go work use
go: module ../../../.. listed in go.work file requires go >= 1.21, but go.work lists go 1.18; to update it:
        go work use
Error: Command failed: go build -ldflags -s -w -o ./vercel-dev-server-go ./...

I believe it’s caused by vercel’s go.work generation here:

https://github.com/vercel/vercel/blob/4052e9b8c61df1bd3d716bfa7a10417834992f46/packages/go/src/index.ts#L785-L790

where it should include the go directive (e.g. go 1.21.0) at the top of the generated go.work file.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (9 by maintainers)

Commits related to this issue

Most upvoted comments

vercel@39.0.3 does not yet does not yet contain the fix, so it would need to be the next release after that number. @DavidChouinard please keep an eye out for that. @jeffreywescott Could you also attempt the next release on your workload. @StefMa I would Ideally prefer 2 independent tests before we close, If there are any specific issues that anyone has I would like to add additional test cases.

I can report back that vercel dev works again. I tested it with this project and this branch.

vercel cli version used: 39.1.0 go version: 1.23.3

Yes – I’ll keep an eye out for a new release here and then give it a whirl!

Looks like that PR got merged, and I’m on the latest version, but still getting this error when using vercel dev locally.

Can someone test the behavior if you add toolchain go1.21.0 to your go.mod file? 🤔

Nope, doesn’t help

oh yep, it looks like a local issue with vercel dev👀