-
Notifications
You must be signed in to change notification settings - Fork 975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug?]: RedwoodJS Deploy to Vercel with a vercel.json in the project causes the deploy to loop for 10minutes on vercel #10022
Comments
Hey @RinKimLaw I tried making a repro (albeit with just the graphql function) and couldn't reproduce 8-10 minute looping builds. One thing I'm wondering: is the I'm wondering if that's the problem. I feel like maybe you should actually end up using the Node.js runtime via |
Hi @jtoar, I'm running into the same issue here trying to extend my function timeouts. The selection of the runtime is referenced in the docs here. It seems this was suggested by vercel support to a user in this community post. As it stands, the default deploy that runs the |
It appears that targeting the root graphql file only will allow you to customize options for the server file but not the nested functions. Building will succeed with this configuration {
"functions": {
"api/src/functions/*.*": {
"maxDuration": 20,
"runtime": "@vercel/[email protected]"
}
} Attempting to set options for a nested function will result in recursive builds {
"functions": {
"api/src/functions/*.*": {
"maxDuration": 20,
"runtime": "@vercel/[email protected]"
},
"api/src/functions/nestedFunction/*.*": {
"maxDuration": 300,
"runtime": "@vercel/[email protected]"
}
}
} I have verified this both with the local This restricts customization and pretty much rules out vercel as viable platform for all but the most simple apps built with redwood. For context I am also running |
I think there's a way to configure the vercel.json for redwoodjs that's not completely/accurately documented anywhere because with the default settings (No vercel.json), the project deploys within 1m30s. Also, all the config in my vercel.json is ignored, the memory size is always the default 1024MB. |
I believe that https://community.redwoodjs.com/t/increase-timeout-duration-of-api-in-vercel/5446/3 address this issue with some docs to set the timeout on Vercel. But I may be wrong? |
Just to clarify - this issue related to the length of the build time (not the timeout of the function) -- because Vercel is building the redwoodJS app multiple times (once per api/function)? |
@dthyresson That documentation only works for the base graphql function. If you try to specify a different timeout or memory settings for the serverless functions in sub-directories, it will build recursively, not just once per function |
I wonder if there's any update on this? I previously tried to post this as an issue on Vercel's github but couldn't get through. For now it's fine deploying Redwood to vercel with default settings for me, but it's a pretty major issue that neither the function size nor the function timeout can be adjusted using vercel.json. |
Hi @RinKimLaw - I am trying to remember the details but does this https://redwoodjs.com/docs/deploy/vercel#verceljson-configuration help? I imagine that one might have to specify a function (not the GraphQL function listed).. I’d this does not help, could you share an example that does not work as expected? |
@dthyresson No that config didn't work for me. It eventually deploys after recursively building everything, but neither of the function parameters are honoured (Memory or timeout). |
Opened an issue on Vercel's side https://github.com/orgs/vercel/discussions/6526 |
@RinKimLaw We will likely have to create a small reproducible case for Vercel to try. Do you have a public repo of a project we can share or could you post the Vercel config you are using to make sure we’re doing the same. Thanks. |
@dthyresson I can setup a public repo tomorrow to demo the issue. |
Thank you so much! This will really help as I can share with Vercel, too. |
Hi, just on my personal account -
Values are not honoured for the tester1 function. The build is also recursive and builds twice, once for each function. |
We are still experiencing this issue months later, to great frustration. Same issue as @DrakenKor |
Hi @bencohen4 have you spoken with to Vercel? Did they give any insight? I’ll connect with them to understand how they build and try to reproduce. I haven’t deployed to Vercel recently. Do they have a local build process like Netlify does that builds locally like they would when deployed? |
Hi @dthyresson I did open up a support ticket with Vercel, they did offer some suggestions but those didn't end up working unfortunately. The case was dropped around the end of January. They do have a local CC'ing @will-govwell for visibility |
Vercel got back to me and I’ll try my own deploy to reproduce. For reference: theypointed me to the redwood build “adapter” https://github.com/vercel/vercel/blob/main/packages/redwood/src/index.ts Also could people @bencohen4 and others share the Vercel config they use? Does it specify the runtime? One thing we want to try is if the runtime setting is removed from each function config. The hypothesis to test is that this build handler is called when a Redwood app builds. By setting that runtime in effect one says build the function with this very same build handler again .. and again per function. If no runtime is defined then we think the config should just be config settings and not trigger additional builds. if you could try that please let me knew of see any difference in build time and logs. |
@dthyresson here is my
Removing the runtime failed the deployment with the error |
Thanks for trying- could you try it you specify a non glob path? And specify the function file directly? |
Will give it a go and let you know! Thanks @dthyresson |
Btw a local “vc build” using the Vercel cli they said should build the same way and should reproduce |
@dthyresson using this
Yielded a build that took 2x as long as usual - because the steps were indeed duplicated - and the resulting Vercel deployment is still maxing out at 15 seconds, not 60 like my vercel.json implies |
Sorry. I may not have been clear ^^* we wanted to try without the runtime value. |
@dthyresson I tried this earlier. Sorry for not being clear - Removing the runtime failed the deployment with the error "Error: The pattern "api/src/functions/*" defined in functionsdoesn't match any Serverless Functions inside theapi directory." |
Hello @bencohen4 and @DrakenKor happy to finally give you both some promising news. Having spoken to Vercel, they have opened an internal issue to fix this. They have suggested to support configuring the function in the function code itself rather than the import type { APIGatewayEvent, Context } from 'aws-lambda'
import { logger } from 'src/lib/logger'
export const config = {
maxDuration: 30,
}
export const handler = async (event: APIGatewayEvent, _context: Context) => {
logger.info(`${event.httpMethod} ${event.path}: tester1 function`)
return {
statusCode: 200,
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
data: 'tester1 function',
}),
}
} I'll update here when I get word on a release fix. And just to let know, yes -- because of the way Vercel's Redwood builder worked, the entire app could recursively build on build n time per function config. This behavior can be seen in logs of simply via a Hope to have good new soon. BTW I like this in function config as it:
|
Thank you @dthyresson!! I agree that defining the config in the function is likely much easier than defining it in json files - less room for errors |
Actually, it's an update necessary to the Vercel builder that handles the Redwood framework here: https://github.com/vercel/vercel/blob/main/packages/redwood/package.json |
Got it. So we are now waiting on Vercel to make a code change to https://github.com/vercel/vercel/blob/main/packages/redwood/package.json then? |
Once they tell me it's fixed and they released, I'll let you know here -- after I confirm and also update the RedwoodJS docs. |
thanks!! |
Thanks, this'll mean I can start using Redwood on Vercel again. |
Have tested fix shown here vercel/vercel#11776 and looking good. Just will have to wait for that to get approved, released and published. via export const config = {
maxDuration: 30,
memory: 512,
}
``` in the function etc. |
Omg @dthyresson thank you!!! Can't wait! |
Fixes: #10022 and #1664 Documents support for Vercel API endpoint (ie, functions) configuration via `export const config` syntax. Can deploy docs here vercel/vercel#11776 merges. --------- Co-authored-by: Josh GM Walker <[email protected]>
What's not working?
This is my vercel.json
My project config is defaults for a redwoodjs project on [email protected].
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)
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: