r/webdev • • 22d ago

Question ci/cd pipeline issue

Post image

hi everyone

I have a ci pipeline where i run build and deploy to cf workers, everytime the build runs it succeeds but it stays hanging on and the next job does not run( see image), it can stay hanging on for hours and it won’t exit at all till i cancel the workflow

i have added a timeout to exit after 2 mins and a continue on error set to true to be able move to the next run which is deploy the worker

2- the deploy runs: npm run deploy:vinext
and it always exits with a message “wrangler versions upload” and the whole ci fails now
but after i check on my cloudflare dashboard i actually find that deploy

running these on terminal manually actually does the work but it’s not what i want

is there any solution that will make the build exit after it finishes and make the deploy works fine

tech: Nextjs app migrated to Vinext

- name: Build Vinext app
env:
CLOUDFLARE_INCLUDE_PROCESS_ENV: true
timeout-minutes: 1
continue-on-error: true
run: npm run build:vinext

- name: Deploy to cf
env:
CLOUDFLARE_API_TOKEN: ${{ env.CLOUDFLARE_API_TOKEN }}
run: npm run deploy:vinext

scripts:

"build:vinext": "vite build",

"start:vinext": "infisical run --env=prod -- vite preview --port 3000",

"deploy:vinext": "vinext-cloudflare deploy --warm-cache --skip-build",


"deploy:response-store": "cf deploy --prebuilt --mode production --worker frontend-response-store"


4 Upvotes

24 comments sorted by

2

u/kdjayakody 22d ago

I would remove the timeout and continue-on-error first, since they mask the failure and can let deploy run with a stale or incomplete artifact. In the build step, log the exit code and inspect which child process is still alive; a build command should exit once its work is done. Then give build and deploy separate jobs with explicit success conditions, and verify the deploy command’s final exit code rather than relying only on the dashboard showing a deployment.

1

u/Low-Insurance-3678 22d ago

yeah you are right on that one
but the build step will never exit wen its completed

yesterday i had a build completed and it stayed running for like 20mins until i canceled the workflow

like even locally it does not exit until i close it with ctrl+c

2

u/kdjayakody 22d ago

That confirms it is not just a workflow runner issue. Try bypassing the script wrapper and run the underlying build command directly; if it still hangs, temporarily disable plugins one at a time and look for one starting a watcher, dev server, or child process. Sharing the build config and the last log lines before it stalls would help pinpoint which hook keeps the process alive.

1

u/Low-Insurance-3678 22d ago

sadly i cant share image in comments

i have run the npx vite build, guess what build is complete but it is hanging on till now lol

one thing that will close it is if i removed the prerender:{routes:”*”} from the vite config but then my routes wont be prerendered on build

id like to dm u and share with u if thats ok with u

1

u/kdjayakody 21d ago

Let’s keep it in the thread so others can follow too. Removing prerender makes it exit, so try one explicit, simple route instead of "*", then add routes back until it hangs. Check whether that route waits on a fetch, starts a timer, or redirects into another route. Paste the relevant config, package versions, and last log lines as text here, with secrets removed; no screenshot needed. That should help separate route discovery from rendering or cleanup.

2

u/Guilty-Olive-8827 22d ago

what is `r //lang`? i've stared at that step for a solid minute trying to work out if it's an alias you set up or a typo that somehow worked

1

u/Low-Insurance-3678 22d ago

hi that’s just a dynamic route that’s how nextjs suggests to make you website support multiple languages

2

u/Geraldwelly 22d ago

The prerender wildcard is the first thing I'd isolate. Run Vite's build API in a tiny Node wrapper, await build(), then log process.getActiveResourcesInfo(); if it resolves with an FSWatcher, Timeout, or server handle still open, a plugin or prerender hook is keeping Node alive. Temporarily disable prerendering and bisect the plugins. Keep continue-on-error off while debugging, or the deploy can proceed with a stale artifact.

1

u/Low-Insurance-3678 22d ago

i think the prerender is what causing that

I will try that man and see
also u got any idea why two of my routes are marked with ? unknown?

2

u/Discordbothost 22d ago

the ? is usually the build saying it couldn't work out at build time whether that route is static or dynamic. with an app/[lang] folder that tends to mean there's no generateStaticParams, so a wildcard prerender has no concrete list of langs to render and has to guess.

try adding this to the [lang] page or layout:

export function generateStaticParams() { return [{ lang: 'en' }, { lang: 'fr' }] }

(swap in your real langs). if the ? turns into a static marker, there's a decent chance the hang goes away too, since a prerender step waiting on a route it can't resolve is exactly the kind of thing that keeps node alive after "build complete". quick way to confirm before touching anything else: swap routes "*" for an explicit list like ["/", "/en"] and see if the build exits on its own

1

u/Low-Insurance-3678 22d ago

those fees and orders routes are dynamic they fetch data from supabase and list it on a table
yep the ? is what was hanging the build on lol
iv slapped those three routes with force dynamic and now the build exits the moment it finishes lol I almost lose my mind to this

i already have a generateStaticParams so that wasn’t a solution

passing array to prerender is not supported yet
only true or “*” are supported

2

u/Discordbothost 21d ago

nice, glad it's exiting now. force-dynamic is the right call for those anyway, a supabase-backed orders table you'd never want baked in at build time, and if any of them read the session it also stops you accidentally caching one user's data for everyone

1

u/Low-Insurance-3678 21d ago

hi i just realized that yesterday i had the prerender commented out that’s why it was exiting after a successful build

i will just keep it off and rely on caching after I deploy

2

u/Geraldwelly 21d ago

Sorry, late to this. The ? just means vinext's static analysis couldn't tell whether those routes call cookies() or headers(), so it can't decide static vs dynamic. Force-dynamic was the right fix. If you lean on caching after deploy, check the dashboard responses go out with Cache-Control: private, no-store, otherwise a cache in front of the Worker can serve one user's orders table to someone else.

2

u/jr_70904 21d ago

The build wasn't hanging after it finished; it was still trying to prerender the Supabase routes. `*` is doing a lot of work there. Keep those routes dynamic, then debug Wrangler's exit separately - a deployment showing up in the dashboard doesn't mean CI got a clean exit.

1

u/Low-Insurance-3678 21d ago

like most of my routes are dynamic yet it never exists

what do u suggest

3

u/quizical_llama 22d ago

your going to need to post some code if you want help.

1

u/Low-Insurance-3678 22d ago

id be happy to, should I share my yaml workflow file?

3

u/quizical_llama 22d ago

before you do, have you googled / asked an AI

1

u/Low-Insurance-3678 22d ago

iv some parts of the code

i have spent two days trying to find a solution, i googled, used free ais but tbh could not find a solution
if you can help id be glad, i can do it manually but thats not the way i want

1

u/Med-Bechir 18d ago

That timeout plus continue-on-error is hiding the exit. Vite is likely leaving a handle open so CI never finishes, and that wrangler versions message is normal output your script treats as fail. Can you paste the exit code and wrangler version from the deploy log?

2

u/[deleted] 22d ago

[removed] — view removed comment

1

u/Low-Insurance-3678 22d ago

hi man i just run npx vite build —debug

that printed an enormous amount of line of lines, ahahahh, but it did exit after build completed
i have pasted the whole thing in chatgpt it said its fine nothing is hanging or still processing

for the last part i actually didn’t understand it correctly if u can elaborate more please