Hi, I am trying to deploy a Typescript + Fastify API to Digital Ocean Functions. I have referred to the example typescript repo: https://github.com/digitalocean/sample-functions-typescript-helloworld and have structured my project in the same manner.
My structure is as follows:
functions
│ ├── packages
│ │ └── api
│ │ └── crud-api
│ │ ├── package.json
│ │ ├── package-lock.json
│ │ ├── schema.sql
│ │ ├── src
│ │ │ ├── config
│ │ │ │ └── supabase.ts
│ │ │ ├── index.ts
│ │ │ ├── middleware
│ │ │ │ ├── auth.ts
│ │ │ │ ├── validate.ts
│ │ │ │ └── validation.ts
│ │ │ ├── routes
│ │ │ │ ├── auth.ts
│ │ │ │ ├── <hidden>.ts
│ │ │ │ ├── <hidden>.ts
│ │ │ │ ├── <hidden>.ts
│ │ │ │ ├── <hidden>.ts
│ │ │ │ └── <hidden>.ts
│ │ │ ├── services
│ │ │ │ ├── <hidden>.ts
│ │ │ │ └── <hidden>.ts
│ │ │ ├── types
│ │ │ │ └── index.ts
│ │ │ └── utils
│ │ │ ├── auth.ts
│ │ │ ├── logger.ts
│ │ │ └── storage.ts
│ │ ├── tsconfig.dev.json
│ │ └── tsconfig.json
│ └── project.yml
My project is very straight forward, CRUD endpoints to a database with less than 100 entries.
The result of doctl serverless deploy functions --remote-build
Deploying '/home/my-project/functions'
to namespace 'fn-****-****-****-****-********'
on host 'https://faas-lon1-****.doserverless.co'
Submitted function 'api/my-api' for remote building and deployment in runtime nodejs:18 (id: 972732c8a3d64c4fa732c8a3d63c4f46)
Processing of action 'api/my-api' is still running remotely ...
Processing of action 'api/my-api' is still running remotely ...
Processing of action 'api/my-api' is still running remotely ...
Processing of action 'api/my-api' is still running remotely ...
Processing of action 'api/my-api' is still running remotely ...
Processing of action 'api/my-api' is still running remotely ...
Processing of action 'api/my-api' is still running remotely ...
Processing of action 'api/my-api' is still running remotely ...
Processing of action 'api/my-api' is still running remotely ...
Processing of action 'api/my-api' is still running remotely ...
Processing of action 'api/my-api' is still running remotely ...
Failures:
Error: While deploying action 'api/my-api' (running remote build): The function exceeded its time limits of 120000 milliseconds.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
Looks like your function hit the 120-second build time limit during remote build.
This usually happens when your dependencies are large or the build process is too complex for the remote builder.
You can check the official limits here: 👉 https://docs.digitalocean.com/products/functions/details/limits/ (“The maximum build time for remote builds is 2 minutes.”)
Try to trim the dependencies in
package.json
(especially dev deps).Also have you tried using a local build instead?
As a last resort, you could try to break the app into smaller functions if possible.
If it still fails, contacting DigitalOcean Support could help you troubleshoot further.
- Bobby