Skip to content
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

Failed to integrate with Bitbucket webhooks #1619

Open
Onlymywind opened this issue Mar 12, 2025 · 2 comments
Open

Failed to integrate with Bitbucket webhooks #1619

Onlymywind opened this issue Mar 12, 2025 · 2 comments
Labels

Comments

@Onlymywind
Copy link

Git provider (optional)

Bitbucket Server

System Info (optional)

No response

Issues details

Here are my actions:

  1. I want to use deepseek, so I modify the configuration.toml:
model="deepseek/deepseek-chat" 
fallback_models=["deepseek/deepseek-chat"]
  1. I want to use bitbucket webhook, so I add bitbucket bearer_token in .secrets.toml, just as the document (I don't know why there is pr_agent/settings/.secrets.toml in the .dockerignore):
[bitbucket_server]
# For Bitbucket Server bearer token
bearer_token = "my-bearer_token"
webhook_secret = ""
...
[deepseek]
key = "my-deepseek-key"
  1. Then I run this command to build docker image:
    docker build . -t codiumai/pr-agent:bitbucket_server_webhook --target bitbucket_server_webhook -f docker/Dockerfile

  2. I didn't push this docker image, I run it locally:
    docker run -d -p 8080:3000 image-id

  3. Then I create the webhook in bitbucket:

Image

The test connection is always error.
I check the response detail, error message is:
Unable to connect to the URL specified within the timeout, please check the host and port are correct and that the URL is accessible from the server running this request.

Could you please help me solve this problem? I would appreciate it if you can help me! Others, I think there are too few tutorials about bitbucket webhook.

@Onlymywind Onlymywind added the general label Mar 12, 2025
Copy link
Contributor

💡 Auto-generated documentation-based answer:

It looks like you're having trouble setting up the Bitbucket Server webhook for PR-Agent. Here are some troubleshooting steps:

  1. Docker Network Issue: The most likely problem is that your Bitbucket Server cannot reach your locally running Docker container. When you run Docker with -p 8080:3000, you're mapping port 3000 inside the container to port 8080 on your host machine, but this is only accessible from your local network.

  2. Solution Options:

    • Use a tunnel service: Set up ngrok or a similar service to expose your local port to the internet: ngrok http 8080
    • Deploy to a publicly accessible server: Instead of running locally, deploy the Docker container to a server that Bitbucket can reach
    • Check firewall settings: Ensure your firewall allows incoming connections on port 8080
  3. Webhook URL: Make sure your webhook URL is using the public address (not localhost), such as the ngrok URL or your server's public IP/domain

  4. Configuration Check:

    • Your configuration in .secrets.toml looks correct
    • The .dockerignore file does include pr_agent/settings/.secrets.toml but your approach of creating a new .secrets.toml file is correct

Try setting up a tunnel with ngrok and use that URL in your Bitbucket webhook configuration, then test the connection again.

Relevant Sources:

@Onlymywind
Copy link
Author

Onlymywind commented Mar 12, 2025

I've changed 'localhost' to my ip-address in url, now when I test connection, it does not fail, but returns 500, response body is:
Internal Server Error

Image Image

Maybe my steps still have some problems? I'd appreciate it if you can help me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant