Umbraco Cloud CI/CD: Bad request The remote server...
# help-with-umbraco
d
Hi there, I have a feeling I'm getting pretty close with my CI/CD pipeline but at the Job:"Upload Source And Start Deployment" the task "Post Zipped Artifact" returns a bad request without any context on why. Anybody an idea on where to find more information why this task gets a bad request? I'm using the provided script from github
devops/powershell/Add-DeploymentPackage.ps1
.
s
Did it work before you made these changes? https://discord.com/channels/869656431308189746/1261301255964327967 Other than that, 20 minutes seems like a LOOOONG time (mine doesn't take that long). Are you including large files in the zip? It might just have become too big a file to handle.
d
Before the zipping i hadn't made it to this step. And the zipping process went from 20+ min to seconds. By changing
7zFM.exe -r $(System.DefaultWorkingDirectory)\sources.zip . -x@cloud.zipignore
to
7z.exe a -r -tzip $(System.DefaultWorkingDirectory)\sources.zip . -x@cloud.zipignore
s
20 minutes is long, what is it zipping? Did you commit the media folder to git, large files, etc?
d
I think it somehow was zipping media and other files it shouldn't. Howover the total size of the project was 874 mb that shouldn't take that long. I think the problem is with the 7zip command 7zFM.exe.
Update to get additional data i changed the ``try catch`` of the Addd-Deploypackage.ps1 to the following code.
Copy code
try {
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    [Net.ServicePointManager]::SecurityProtocol = "Tls12"
    $response = Invoke-WebRequest -Body $multipartContent -Headers $umbracoHeader  -Method 'POST' -Uri $url

    Write-Host "---Response Start---"
    Write-Host $response.Content | ConvertTo-Json
    Write-Host "---Response End---"

    if ($response.StatusCode -ne 202)
    {
        Write-Host "---Response Start---"
        Write-Host $response
        Write-Host "---Response End---"
        Write-Host "Unexpected response - see above"
        exit 1
    }

    Write-Host $response.Content | ConvertTo-Json
    exit 0
}
catch {
    Write-Host "---Error Start---"
    Write-Host $_
    Write-Verbose "An exception was caught: $($_.Exception.Message)"
    
    try {
        if ($_.Exception.Response) {
            $errorResponse = $_.Exception.Response.GetResponseStream()
            $reader = New-Object System.IO.StreamReader($errorResponse)
            $responseBody = $reader.ReadToEnd()
            $reader.Close()
            
            Write-Host "---Response Start---"
            Write-Host $responseBody | ConvertTo-Json
            Write-Host "---Response End---"
        }
    }
    catch {
        Write-Host "No response content available"
    }

    Write-Host "---Error End---"
    exit 1
}
This tries to log additional data from the response. Using this i figured out i changed my location of my zip on the create zip step and not on the deploy. stil not deployed to cloud but getting closer.
s
> 874 mb that shouldn't take that long That is enormous! Cloud runs on relatively low powered instances that are meant to serve websites and allow for speedy editing, zipping up that much data is serious computing, that's why it's taking so long. It seems to me like you have a lot of static files in there that definitely shouldn't be in your git repository.
d
Ah good will take a look into that!
e
4 Views