abc
August 19, 2024, 4:39pm
1
I have a redwoodjs project deployed on Vercel. I ran into this issue ~1.5 months ago, where the app could no longer deploy on Vercel: ~2 minutes after building, directly after migrations, I would get this error:
Error: File not found: /vercel/path0/api/src/functions/auth.js
Strangely, trying to redeploy prior versions (that previously deployed without any issues) also led to this error. I sort of chalked this up to an error on Vercel/RedwoodJS, but the issue still persists 40 days later. Couldn’t find any similar issues online and also strange given that I use ts and not js (and that’s reflected in my Vercel settings). No local issues either.
Can you share a link to a repo or your Vercel config and toml?
Is your redwood.toml
file, setting `apiUrl = "/api”
abc
August 20, 2024, 12:45am
3
Thanks for the response. Here is redwood.toml
:
`# This file contains the configuration settings for your Redwood app.
This file is also what makes your Redwood app a Redwood app.
If you remove it and try to run yarn rw dev
, you’ll get an error.
For the full list of options, see the “App Configuration: redwood.toml” doc:
[web]
title = “RedwoodApp”
port = 8910
apiUrl = “/api”
includeEnvironmentVariables = [
# Add any ENV vars that should be available to the web side to this array
# See Environment Variables | RedwoodJS Docs
]
[api]
port = 8911
[browser]
open = true
[notifications]
versionUpdates = [“latest”]`
Here are my Vercel settings:
Framework preset: RedwoodJS
Build command: yarn rw deploy vercel
Install command: corepack enable && yarn set version 3.7.0 && yarn install
NodeJS Version: 20.x
(Relevant) env variables:
ENABLE_EXPERIMENTAL_COREPACK
: 1
YARN_ENABLE_IMMUTABLE_INSTALLS
: false
Also we and Vercel recently fixed an issue where the way Redwood projects are built:
opened 06:07AM - 16 Feb 24 UTC
closed 12:54PM - 16 Jul 24 UTC
bug/repro-available
bug/confirmed
topic/deployment
### What's not working?
This is my vercel.json
```
{
"functions": {
"… api/src/functions/minutesync/minutesync.*": {
"memory": 256,
"runtime": "@vercel/redwood@2.0.7"
},
"api/src/functions/asauth/asauth.*": {
"memory": 512,
"runtime": "@vercel/redwood@2.0.7"
},
"api/src/functions/ascallback/ascallback.*": {
"memory": 128,
"runtime":"@vercel/redwood@2.0.7"
},
"api/src/functions/asrefresh/asrefresh.*": {
"memory": 256,
"runtime":"@vercel/redwood@2.0.7"
},
"api/src/functions/bulksync/bulksync.*": {
"memory": 128,
"runtime":"@vercel/redwood@2.0.7"
},
"api/src/functions/graphql.*": {
"memory": 512,
"runtime":"@vercel/redwood@2.0.7"
}
}
}
```
My project config is defaults for a redwoodjs project on RedwoodJS@6.6.4.
With the vercel.json the build keeps looping again and again for 8-10 minutes and then eventually succeeds
Without the vercel.json the build succeeds in 1m30s
I'm guessing Vercel's default config for RedwoodJS projects is somehow being overridden by my vercel.json, causing this looping behaviour.
### How do we reproduce the bug?
Create a new project with RedwoodJS typescript and setup a vercel deploy. Add a vercel.json to the project with some config for the functions.
### What's your environment? (If it applies)
```shell
System:
OS: Windows 10 10.0.19045
Binaries:
Node: 18.19.0 - ~\AppData\Local\Temp\yarn--1708063642733-0.2390738274290265\node.CMD
Yarn: 1.22.17 - ~\AppData\Local\Temp\yarn--1708063642733-0.2390738274290265\yarn.CMD
Browsers:
Chrome: 121.0.6167.185
Edge: Chromium (121.0.2277.112)
npmPackages:
@redwoodjs/core: 6.6.4 => 6.6.4
```
### Are you interested in working on this?
- [X] I'm interested in working on this
And
vercel:main
← vercel:tootallnate/zero-2152-investigate-if-vercel-builds-redwood-app-per-function-with
opened 09:52PM - 28 Jun 24 UTC
Uses the `@vercel/static-config` module to get the `export const config` configu… ration for Redwood.js API endpoints, so it's the same interface as vanilla JS endpoints, and Remix.
The previous usage of `getLambdaOptionsFromFunction` was broken because it would cause the `@vercel/redwood` Builder to be executed multiple times (once for each endpoint).
And that could explain the 2 minute build time.
I’d make sure you have the latest vercel/redwood package (was fixed a month ago)