I am having trouble getting our functions to package. Locally, I can build my site and even deploy it, but when it goes through the automated build process, the functions bundling fails due to missing dependencies.
Local:
────────────────────────────────────────────────────────────────
2. Functions bundling
────────────────────────────────────────────────────────────────
Packaging Functions from functions directory:
- xxxx-xxxxx/index.ts
- xxxxx-xxxxxxx/index.ts
- xxxxx-xxxx/index.ts
etc... (it works)
and then I can even deploy it and things work
netlify deploy
Deploy path: /Users/lnsv/Source/mono_client_com/packages/dashboard/build
Functions path: /Users/lnsv/Source/mono_client_com/packages/dashboard/functions
Configuration path: /Users/lnsv/Source/mono_client_com/packages/dashboard/netlify.toml
Deploying to draft URL...
✔ Deploying functions from cache (use --skip-functions-cache to override)
✔ Finished hashing 46 files and 13 functions
✔ CDN requesting 13 files and 13 functions
✔ Finished uploading 26 assets
✔ Deploy is live!
Netlify Build (Non-Local):
10:13:45 PM:
10:13:45 PM: ──────────────────────────────────────────────
──────────────────
10:13:45 PM: 2. Functions bundling
10:13:45 PM:
────────────────────────────────────────────────────────────────
10:13:45 PM:
10:13:45 PM: Packaging Functions from functions directory:
10:13:45 PM: - xxxxx-xxxxxxx/index.ts
10:13:45 PM: - xxxx-xxxx/index.ts
10:13:45 PM: - xx-xxxxxxx/index.ts
etc...
10:13:45 PM: > ../database/pilotpayload.ts:1:84: error: Could not resolve "@typegoose/typegoose" (mark it as external to exclude it from the bundle)
10:13:45 PM: 1 │ ...s, prop, Ref, Severity, index, mongoose} from "@typegoose/typegoose";
10:13:45 PM: ╵ ~~~~~~~~~~~~~~~~~~~~~~
10:13:45 PM: > ../database/pilotpayload.ts:2:25: error: Could not resolve "@typegoose/typegoose/lib/internal/constants" (mark it as external to exclude it from the bundle)
10:13:45 PM: 2 │ import { WhatIsIt } from "@typegoose/typegoose/lib/internal/constants";
etc......
I’ve tried adding a package.json in my functions directory, adding the supposedly missing typegoose
package to every package.json I can find, clearing the build cache.
I am stumped by the successful build/deploy from my machine, but failures when being built by Netlify’s build servers.
Any help would be appreciated!.