I am unable to build/deploy a digital ocean function that relies on nonstandard libraries (some third party, others local). I have three projects: an API, the DO functions, and a common library used by both. I tried the solution described in this post but it didn't fix the issue.
$ doctl serverless deploy functions
results in
Deploying '/home/swpulitzer/temp/repo/functions/functions'
to namespace 'fn-51b50945-486a-4071-9820-13e076fd4ee8'
on host 'https://faas-nyc1-2ef2e6cc.doserverless.co'
Submitted function 'bots/whiteface' for remote building and deployment in runtime go:default (id: 1a040a6618174c38840a6618177c38e5)
Transcript of remote build session for action 'bots/whiteface':
Output of failed build in %s
/tmp/slices/builds/fn-51b50945-486a-4071-9820-13e076fd4ee8/bots_whiteface/2025-11-24T20-24-13.602Z/packages/bots/whiteface
initializing modules
go: creating new go.mod: module exec
go: to add module requirements and sums:
go mod tidy
building
scrape.go:4:2: package api/common is not in GOROOT (/usr/local/go/src/api/common)
scrape.go:5:2: package api/handlers is not in GOROOT (/usr/local/go/src/api/handlers)
scrape.go:6:2: package api/logger is not in GOROOT (/usr/local/go/src/api/logger)
scrape.go:8:2: package common/models is not in GOROOT (/usr/local/go/src/common/models)
scrape.go:11:2: package functions/lib is not in GOROOT (/usr/local/go/src/functions/lib)
scrape.go:18:2: no required module provides package github.com/PuerkitoBio/goquery; to add it:
go get github.com/PuerkitoBio/goquery
scrape.go:19:2: no required module provides package github.com/labstack/gommon/log; to add it:
go get github.com/labstack/gommon/log
My project structure is below. Is it possible to tell doctl where these packages are so it can link to them in the build?
repo/ <- workspace
go.work
go.work.sum
api/ <-- API module
common/ <-- common module used by both API and functions
functions/ <-- Digital Ocean functions
go.mod
go.sum
lib/
objects.go
utilities.bo
functions/
project.yml
packages/
bots/
whiteface/
main.go
scrape.go
go.modfor your module, so it's trying to resolve the dependencies on the fly.replacein a main package's module to locate directories by relative paths. It would probably just be better to include the local packages within the module if you don't want to publish them, rather than trying to force them into whatever process this deploy mechanism uses.