netlify / netlify/open-api

Site doesn't respond to event from webhook when created using createSite

Open
#143 16 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
323
Forks
133
Avg merge
2d 8h
Merged PRs (30d)
2

Description

When I create a site with a linked GitLab repository using the createSite operation, the site doesn't respond to incoming events (push or merge request) from the webhook (https://api.netlify.com/hooks/gitlab).

Here's the API call I'm using to create the site (which contains a netlify.toml file):

const Netlify = require('netlify')
const client = new Netlify(process.env.NETLIFY_TOKEN)

;(async () => {
  const { id: deployKeyId } = await client.createDeployKey()
  const site = await client.createSite({
    body: {
      repo: {
        provider: 'gitlab',
        deploy_key_id: deployKeyId,
        repo_path: 'group/repo-name',
        repo_branch: 'master',
      }
    }
  })
})()

If I click "Edit settings", then "Link to a different repository", the site starts responding to events from the webhook. However, there doesn't seem to be any change in the site settings (at least as reported by the API).

Is the createSite API not capable of setting up a site with CI properly? If so, what setting am I missing?

I also noticed that even if the repository is public, and I set the public_repo property to true, Netlify still reports the repository as private (as indicated by the lock icon next to the repository URL on the Build Settings page and confirmed by the API).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the createSite call with a GitLab repository and compare its resulting settings with the Edit settings → Link to a different repository flow. Check behavior against the https://api.netlify.com/hooks/gitlab webhook for push and merge request events, including the public_repo value. Done means sites created through createSite respond to those events and public repositories are reported correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.