For me, the issue was caused by a relative import for something outside the functions
folder:
import ... from "../../../src/something.ts"
Everything worked when I removed this line, deleted my functions/lib
folder, and ran npm run build
again in my functions
folder.