Deploy from Gitlab to CF Pages fails on initialisation

I am trying to add a Hugo site to Cloudflare Pages that is hosted on a Gitlab repository. After adding the project the build fails immediately on initialisation with the following error message:

14:31:41.999	Initializing build environment. This may take up to a few minutes to complete
14:31:41.999	Failed to start the deployment due to an internal error

Deleting the project and re-adding it or enabling/disabling the new fast deploy option does not lead to a change. What could be the issue? The error is not very informative, but it looks like something is not working before the repository is cloned.

After some days the behaviour is still the same. So it’s not a cache issue :wink:


Sorry I missed this post initially. Could you please let me know what your link is?

Hi Walshy, thank you for your response. The link is

I don’t see a more recent deployment than 2 days ago. If you can trigger one now I could look a bit more into it.

Is this repo in an organisation in GitLab? If so, what is your role on that repo? You will need to be at leas the “maintainer” role.

I just retried a deployment. I am not a maintainer of the project, but the maintainer added the project. I’ll hand him a link to this thread in case you have some info about how to set up the Gitlab repo for this.

The maintainer tried to add the project by themselves, but I am not sure if the current connection is done by me or the maintainer. Let me know if you want me to have them re-connect the repo.

Yeah looks like we aren’t able to get the data we need from GitLab which points to a permission issue. Get the maintainer to re-add the project and let me know if that resolves the issue.

1 Like

Thank you, I told the maintainer. It might take a bit… timezones :slight_smile:

Hi @Walshy, the project is now added by the maintainer. Still failing though :slight_smile:

1 Like

Did you make sure to remove the project first from the account it was on?

What’s the new

yes, and it’s again.

Yeah looks like we’re still having a permission issue, getting a 403 from GitLab. Something about the GitLab setup makes the user who added this not have permission.

The user is me, but I am pretty sure I own the group. Maybe something went wrong with the initial setup, I’ll try to find the application in GitLab and remove it.


I don’t have any Access Tokens or Applications listed in either my profile, the Group or the project that relate to Cloudflare, but I am able to choose the group and the project when creating the Pages project.

Okay, so what I think happened here is that @davidsneighbour authorized Gitlab first and added an access token for his account (I also see a group that I don’t have access to there, which I was always confused about).

When I was creating the Project, despite being the maintainer, I was using the access through his gitlab account.

Without recreating the project, the build environment now correctly initializes.

I went through “Pages > Create Project > GitLab > Add Account”, it showed the project already “In Use”, but that’s ok, if retrying the build, it now builds.

Thank you so much for your help, both of you!


Maybe this is of help for the developers of CFPages: When I added the project the first time, the “add project” button was disabled. I reloaded the page multiple times and one of those times (after authenticating with Gitlab) the button was enabled and I pushed it :slight_smile:

Huh interesting. Thank you both so much for your persistence and help through this! We definitely need to work on the GitLab flow and this helps a lot.