Skip to content

Commit

Permalink
Merge branch 'main' into dt-trusted-docs-extra-config
Browse files Browse the repository at this point in the history
  • Loading branch information
dthyresson authored Jul 19, 2024
2 parents 27fa0ba + 89c19f6 commit 2fcb97f
Show file tree
Hide file tree
Showing 20 changed files with 101 additions and 64 deletions.
55 changes: 46 additions & 9 deletions docs/docs/deploy/vercel.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,54 @@ From the Vercel Dashboard you can access the full settings and information for y

From now on, each time you push code to your git repo, Vercel will automatically trigger a deploy of the new code. You can also manually redeploy if you select "Deployments", then the specific deployment from the list, and finally the "Redeploy" option from the vertical dots menu next to "Visit".

## vercel.json configuration
## Configuration

By default, API requests in Vercel have a timeout limit of 15 seconds. To extend this duration, you can modify the vercel.json file by inserting the code snippet provided below. Please be aware that the ability to increase the timeout limit is exclusive to Pro plan subscribers. Additionally, it is important to note that the timeout can be increased up to a maximum of 300 seconds, which is equivalent to 5 minutes.
You can use `vercel.json` to configure and override the default behavior of Vercel from within your project. For [`functions`](#functions), you should configure in code directly and not in `vercel.json`.

```
{
"functions": {
"api/src/functions/graphql.*": {
"maxDuration": 120,
"runtime": "@vercel/redwood@2.0.5"
}
### Project

The [`vercel.json` configuration file](https://vercel.com/docs/projects/project-configuration#configuring-projects-with-vercel.json) lets you configure, and override the default behavior of Vercel from within your project such as rewrites or headers.

### Functions

By default, API requests in Vercel have a timeout limit of 15 seconds, but can be configured to be up to 90 seconds. Pro and other plans allow for longer [duration](https://vercel.com/docs/functions/runtimes#max-duration) and larger [memory-size limits](https://vercel.com/docs/functions/runtimes#memory-size-limits).

To change the `maxDuration` or `memory` per function, export a `config` with the settings you want applied in your function. For example:

```ts
import type { APIGatewayEvent, Context } from 'aws-lambda'

import { logger } from 'src/lib/logger'

export const config = {
maxDuration: 30,
memory: 512,
}

export const handler = async (event: APIGatewayEvent, _context: Context) => {
logger.info(`${event.httpMethod} ${event.path}: vercel function`)

return {
statusCode: 200,
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
data: 'vercel function',
}),
}
}

```

:::tip important
Since Redwood has it's own handling of the api directory, the Vercel flavored api directory is disabled. Therefore you don't use the "functions" config in `vercel.json` with Redwood.

Also, be sure to use Node version 20.x or greater or set the `runtime` in the function config:
```ts
export const config = {
runtime: 'nodejs20.x',
}
```

:::
2 changes: 1 addition & 1 deletion packages/api-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"devDependencies": {
"@redwoodjs/framework-tools": "workspace:*",
"@types/aws-lambda": "8.10.138",
"@types/aws-lambda": "8.10.141",
"@types/lodash": "4.17.5",
"@types/qs": "6.9.15",
"@types/split2": "4.2.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"devDependencies": {
"@babel/cli": "7.24.5",
"@babel/core": "^7.22.20",
"@types/aws-lambda": "8.10.138",
"@types/aws-lambda": "8.10.141",
"@types/jsonwebtoken": "9.0.6",
"@types/memjs": "1",
"@types/pascalcase": "1.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@babel/cli": "7.24.5",
"@babel/core": "^7.22.20",
"@redwoodjs/api": "workspace:*",
"@types/aws-lambda": "8.10.138",
"@types/aws-lambda": "8.10.141",
"@types/jsonwebtoken": "9.0.6",
"typescript": "5.4.5",
"vitest": "1.6.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/clerk/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@babel/cli": "7.24.5",
"@babel/core": "^7.22.20",
"@redwoodjs/api": "workspace:*",
"@types/aws-lambda": "8.10.138",
"@types/aws-lambda": "8.10.141",
"typescript": "5.4.5",
"vitest": "1.6.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/dbAuth/middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@redwoodjs/api": "workspace:*",
"@redwoodjs/framework-tools": "workspace:*",
"@redwoodjs/graphql-server": "workspace:*",
"@types/aws-lambda": "8.10.138",
"@types/aws-lambda": "8.10.141",
"concurrently": "8.2.2",
"publint": "0.2.9",
"ts-toolbelt": "9.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/firebase/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@babel/cli": "7.24.5",
"@babel/core": "^7.22.20",
"@redwoodjs/api": "workspace:*",
"@types/aws-lambda": "8.10.138",
"@types/aws-lambda": "8.10.141",
"typescript": "5.4.5",
"vitest": "1.6.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/netlify/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@babel/cli": "7.24.5",
"@babel/core": "^7.22.20",
"@redwoodjs/api": "workspace:*",
"@types/aws-lambda": "8.10.138",
"@types/aws-lambda": "8.10.141",
"@types/jsonwebtoken": "9.0.6",
"typescript": "5.4.5",
"vitest": "1.6.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/supabase/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"devDependencies": {
"@babel/cli": "7.24.5",
"@babel/core": "^7.22.20",
"@types/aws-lambda": "8.10.138",
"@types/aws-lambda": "8.10.141",
"@types/jsonwebtoken": "9.0.6",
"typescript": "5.4.5",
"vitest": "1.6.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/supabase/middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@redwoodjs/auth": "workspace:*",
"@redwoodjs/framework-tools": "workspace:*",
"@redwoodjs/graphql-server": "workspace:*",
"@types/aws-lambda": "8.10.138",
"@types/aws-lambda": "8.10.141",
"concurrently": "8.2.2",
"publint": "0.2.9",
"ts-toolbelt": "9.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"listr2": "6.6.1",
"lodash": "4.17.21",
"pascalcase": "1.0.0",
"prettier": "3.3.2",
"prettier": "3.3.3",
"prompts": "2.4.2",
"smol-toml": "1.2.2",
"terminal-link": "2.1.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"pascalcase": "1.0.0",
"pluralize": "8.0.0",
"portfinder": "1.0.32",
"prettier": "3.3.2",
"prettier": "3.3.3",
"prisma": "5.15.1",
"prompts": "2.4.2",
"rimraf": "5.0.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/codemods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"graphql": "16.8.1",
"jscodeshift": "0.15.0",
"pascalcase": "1.0.0",
"prettier": "3.3.2",
"prettier": "3.3.3",
"tasuku": "2.0.1",
"typescript": "5.4.5",
"yargs": "17.7.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-react": "7.34.2",
"eslint-plugin-react-hooks": "4.6.0",
"prettier": "3.3.2"
"prettier": "3.3.3"
},
"devDependencies": {
"@babel/cli": "7.24.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/forms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"core-js": "3.37.1",
"graphql": "16.8.1",
"pascalcase": "1.0.0",
"react-hook-form": "7.52.0"
"react-hook-form": "7.52.1"
},
"devDependencies": {
"@babel/cli": "7.24.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@envelop/types": "5.0.0",
"@redwoodjs/project-config": "workspace:*",
"@redwoodjs/realtime": "workspace:*",
"@types/aws-lambda": "8.10.138",
"@types/aws-lambda": "8.10.141",
"@types/jsonwebtoken": "9.0.6",
"@types/lodash": "4.17.5",
"@types/uuid": "9.0.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"fs-extra": "11.2.0",
"graphql": "16.8.1",
"kill-port": "1.6.1",
"prettier": "3.3.2",
"prettier": "3.3.3",
"rimraf": "5.0.9",
"source-map": "0.7.4",
"string-env-interpolation": "1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/realtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@graphql-yoga/plugin-defer-stream": "3.3.1",
"@graphql-yoga/plugin-graphql-sse": "3.3.1",
"@graphql-yoga/redis-event-target": "3.0.0",
"@graphql-yoga/subscription": "5.0.0",
"@graphql-yoga/subscription": "5.0.1",
"@n1ru4l/graphql-live-query": "0.10.0",
"@n1ru4l/in-memory-live-query-store": "0.10.0",
"graphql": "16.8.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@testing-library/jest-dom": "6.4.6",
"@testing-library/react": "14.3.1",
"@testing-library/user-event": "14.5.2",
"@types/aws-lambda": "8.10.138",
"@types/aws-lambda": "8.10.141",
"@types/babel-core": "6.25.10",
"@types/jest": "29.5.12",
"@types/node": "20.12.12",
Expand Down
Loading

0 comments on commit 2fcb97f

Please sign in to comment.