Skip to content

Commit

Permalink
docs(docs): Added workers page for edge limitations
Browse files Browse the repository at this point in the history
  • Loading branch information
itpropro committed Feb 17, 2023
1 parent ee565d3 commit ba0a184
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions docs/content/2.deploy/2.workers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: Workers
description: Nitro provides out of the box support for deploying to Edge Workers.
---

## Deploy to Workers

Nitro provides out of the box support for deploying to different Edge Worker offerings as well as service workers.

- [cloudflare](/deploy/providers/cloudflare#cloudflare-workers)
- [vercel](/deploy/providers/vercel#vercel-edge-functions)
- service-workers ([switch to this preset](/deploy/#changing-the-deployment-preset))

::alert{type="warning"}
**Limitations**
:br
Deploying to edge workers has some limitations. See [limitations](/deploy/workers/#limitations) for more details.
::

### Limitations

- No support for raw TCP/IP traffic
- Execution time is limited compared to classic serverless offerings (normally 15-30 seconds)
- Limited access to storage

> You can use the [unstorage](/guide/introduction/storage) driver `cloudflare-kv-http` or `cloudflare-kv-bindings` for Cloudflare workers
- Size is very limited (normally a few MBs)
- Limited or no access to Node.js APIs
- [Cloudflare Workers APIs](https://developers.cloudflare.com/workers/runtime-apis)
- [Vercel Edge Functions APIs](https://vercel.com/docs/concepts/functions/edge-functions/edge-functions-api)

### Incompatible libraries

::alert{type="info"}
**Help us**
:br
If you come across a library that you assume to be incompatible with edge workers, please open an issue on the [nitro repo](https://github.com/unjs/nitro/issues/new/choose) and help us keeping this list up to date.
::

The following libraries are known to be incompatible with edge workers because of one of the above mentioned limitations:

- `mongodb`

> There are possible fixes for MongoDB, like using Realm and the [Realm SDK](https://www.mongodb.com/docs/realm/sdk/node/) or
> using http interfaces (only available when self hosting MongoDB), but these are untested.
- `mysql`

> You can find an example with a modified MySQL driver [here](https://github.com/cloudflare/worker-template-mysql)
- `rhea`
- `gremlin`
- `ioredis`
- `cassandra-driver`
- `kafkajs`

0 comments on commit ba0a184

Please sign in to comment.