coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: Nextjs App Auto deploying not working

Open imaxisXD opened this issue 1 year ago • 16 comments

Description

I have recently switched to coolify and hosted my nextjs app but its not auto-deploying based on git commits

image image As you can see both the commit-msg are different

Also, I have installed the git webhook still the issue is there

Minimal Reproduction (if possible, example repository)

Same step as ususall If want can provide the access to repousual

Exception or Error

No response

Version

v4.0.0-beta.297

imaxisXD avatar Jun 15 '24 10:06 imaxisXD

I'm having the same problem, I commit to my main branch (which the resource is set up on) and nothing happens to my deployments. Same version.

Manually redeploying does create an updated version

sunipan avatar Jun 19 '24 16:06 sunipan

Where are you hosting?

Double-check that your server allows inbound traffic on port 8000 that GitHub uses to invoke the webhook.

jonas-johansson avatar Jun 19 '24 20:06 jonas-johansson

Maybe related to https://github.com/coollabsio/coolify/issues/2614

mbeaudru avatar Jun 20 '24 19:06 mbeaudru

@imaxisXD Can you please show me this view? image

andrasbacsai avatar Jun 21 '24 12:06 andrasbacsai

Where are you hosting?

Double-check that your server allows inbound traffic on port 8000 that GitHub uses to invoke the webhook.

Thanks @jonas-johansson.

To @sunipan: Just to make it clear, if you are using a domain, then port 8000 is not required. It depends on how you configured your GitHub App (to send webhooks on ip:port or domain).

Also, please open your GitHub App (you can navigate to it on the same view in my previous comment), and show me the failed webhooks.

andrasbacsai avatar Jun 21 '24 13:06 andrasbacsai

I'm facing the same issue. I have a private repo with a GitHub App configured. I'm using Cloudflare Tunnels. And whenever I push a commit it does not trigger any deployment.

In my coolify project I have this config: coolify-project-config

And in my Github App I have this webhook URL: github-app-config

I also tried to change the webhook URL to http://coolify.mydomain.com/api/v1/ and http://coolify.mydomain.com/ and neither works... I receive a 301 error in the events my github app send: image

ivanpajon avatar Jul 11 '24 15:07 ivanpajon

was facing the same issue, had to remove resource with a public git repo and install a new private one with githup app and then it started working. getting webhook deployments now automatically, the repo is still public tho. port 8000 was open, too. not sure what was the issue with the default approach

kualta avatar Jul 30 '24 17:07 kualta

I'm facing the same issue. I have a private repo with a GitHub App configured. I'm using Cloudflare Tunnels. And whenever I push a commit it does not trigger any deployment.

In my coolify project I have this config: coolify-project-config

And in my Github App I have this webhook URL: github-app-config

I also tried to change the webhook URL to http://coolify.mydomain.com/api/v1/ and http://coolify.mydomain.com/ and neither works... I receive a 301 error in the events my github app send: image

I have the same setup and have the same issue. I have to manually click "redeploy" after each time I push to main branch.

amr3k avatar Aug 27 '24 07:08 amr3k

I finally found the solution (at least for the bug with Cloudflare configuration). Error 301 is caused due to webhooks not supporting redirections. By default, Github App created through Coolify sets all URLs with http, but Cloudflare redirects them to https and this is causing the 301 error. So the solution is going to Github App configuration and change all URLs pointing to our Coolify domain to https. I apply this and now it works perfect.

I hope this helps!

ivanpajon avatar Aug 27 '24 21:08 ivanpajon

Im not getting any 301 error, but Im getting this message in github deliveries.

Nothing to do. No applications found with branch 'stage'.

Do, I need to change anything in source section for commit SHA, currently its set as HEAD.

image

My setup is also same i.e. using cloudflare tunnels to connect to my local server. Im also getting the same issue, i..e auto deploy not working. But manual deployment is working fine also Im able to fetch repository.

One thing I noticed is that, coolify is connected with github organization. I'm not able to open few github links from coolify, Im getting 404 for those links, its not mapping to proper github organisation. Not sure if this is related to this issue.

@andrasbacsai can you please help me into this, as auto deployment is the feature we really need, thanks :) Happy to debug along with you on this, if needed.

VipinGoyal avatar Sep 11 '24 13:09 VipinGoyal

Im not getting any 301 error, but Im getting this message in github deliveries.

Nothing to do. No applications found with branch 'stage'.

Do, I need to change anything in source section for commit SHA, currently its set as HEAD.

image My setup is also same i.e. using cloudflare tunnels to connect to my local server. Im also getting the same issue, i..e auto deploy not working. But manual deployment is working fine also Im able to fetch repository.

One thing I noticed is that, coolify is connected with github organization. I'm not able to open few github links from coolify, Im getting 404 for those links, its not mapping to proper github organisation. Not sure if this is related to this issue.

@andrasbacsai can you please help me into this, as auto deployment is the feature we really need, thanks :) Happy to debug along with you on this, if needed.

This one is fixed, what I did, I created project again with stage branch, earlier I created project with main branch and changed the branch in settings probably thats why this issue occurred.

VipinGoyal avatar Sep 11 '24 15:09 VipinGoyal

occurred.

Oh! I need to test this!

andrasbacsai avatar Sep 11 '24 15:09 andrasbacsai

I finally found the solution (at least for the bug with Cloudflare configuration). Error 301 is caused due to webhooks not supporting redirections. By default, Github App created through Coolify sets all URLs with http, but Cloudflare redirects them to https and this is causing the 301 error. So the solution is going to Github App configuration and change all URLs pointing to our Coolify domain to https. I apply this and now it works perfect.

I hope this helps!

yeah! that's it.

I changed the url to HTTP-S within the settings in my github app and it worked.

in the field: "Webhook URL" in github settings.

thanks!

tech3br avatar May 29 '25 05:05 tech3br

Im not getting any 301 error, but Im getting this message in github deliveries.

Nothing to do. No applications found with branch 'stage'.

Do, I need to change anything in source section for commit SHA, currently its set as HEAD.

image My setup is also same i.e. using cloudflare tunnels to connect to my local server. Im also getting the same issue, i..e auto deploy not working. But manual deployment is working fine also Im able to fetch repository.

One thing I noticed is that, coolify is connected with github organization. I'm not able to open few github links from coolify, Im getting 404 for those links, its not mapping to proper github organisation. Not sure if this is related to this issue.

@andrasbacsai can you please help me into this, as auto deployment is the feature we really need, thanks :) Happy to debug along with you on this, if needed.

I have the same issue. I think this is not fixed yet. @andrasbacsai

bulutfatih avatar May 29 '25 19:05 bulutfatih

I have a similar issue with a new github application. My old github application works as before (publishing to a different server).

So far I haven't found a solution/difference between the two (same coolify version for both beta.418)

All urls in github use https and look exactly the same as in the working github app. Both apps run for the same github repository and post to different coolify instances.

Image

Image

Image

Github reports Nothing to do. No applications found with branch 'staging'

I renamed the branch to coolify and updated my git source for the app - but same result

Image

marwie avatar Jun 09 '25 13:06 marwie

I have the same issue, btw. it's not just nextjs app, I have docker compose deploy, same behavior. I did similar debugging and recreation to @marwie , same (bad) result.

I have temporarily changed that to webhook if it helps, and I call it from github actions:

# github actions
...
  deploy:
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
      - name: Notify Coolify About Deployment
        run: |
          # Force HTTP/1.1 and add retries to avoid HTTP/2 protocol errors
          curl --http1.1 --retry 3 --retry-delay 5 --fail-with-body \
            "https://<coolify path>/api/v1/deploy?uuid=<app id>&force=false" \
            --header 'Authorization: Bearer ${{secrets.COOLIFY_MAIN_DEPLOYMENT_WEBHOOK_TOKEN}}'

where the webhook path can be found in the Applications -> Webhooks and the API key is under Keys and Tokens -> API keys (and here I saved that into the repository Actions secret).

hnykda avatar Jun 15 '25 11:06 hnykda