Our octopus instance started failing to create releases with below exception all of a sudden. Any clues as to why this might happen?
System.Exception: Error while executing SQL command: Cannot insert the value NULL into column ‘ChannelId’, table ‘OctopusEUS.dbo.Release’; column does not allow nulls. INSERT fails.
The statement has been terminated.
The command being executed was:
INSERT INTO dbo.[Release] (Version, Assembled, ProjectId, ProjectVariableSetSnapshotId, ProjectDeploymentProcessSnapshotId, Id, Json) values (@Version, @Assembled, @ProjectId, @ProjectVariableSetSnapshotId, @ProjectDeploymentProcessSnapshotId, @Id, @Json) —> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column ‘ChannelId’, table ‘OctopusEUS.dbo.Release’; column does not allow nulls. INSERT fails.
The statement has been terminated.
Thanks for reaching out. Couple of troubleshooting questions:
Which version of Octopus are you running?
Which version were you running before that one?
Could you send us the JSON you get when browsing /api/projects/[Project ID]/channels ? Please keep in mind that [Project ID] is not the same as project name and should be in the format Projects-[Number]. If you are not sure about your project ID, browse /api/projects/all and look for the ID of that project. The full URL should look a bit like this: http://[OctopusURL]/api/projects/Projects-1/channels
Actually, between 3.2.6 and 3.3.4 we fixed a couple of issues regarding channels and their IDs, so it makes sense that it got fixed once you upgraded to the latest version.
Hey guys, got this same exception after upgrading to 3.4.0-beta0001.
The stack trace as been attached, it also contains the channel json.
Error while executing SQL command: Cannot insert the value NULL into column ‘ChannelId’, table ‘OctopusDeploy.dbo.Deployment’; column does not allow nulls. INSERT fails.
The statement has been terminated.
The command being executed was:
INSERT INTO dbo.[Deployment] (Name, Created, EnvironmentId, ProjectId, ReleaseId, ProjectGroupId, TaskId, TenantId, DeployedBy, DeployedToMachineIds, Id, Json) values (@Name, @Created, @EnvironmentId, @ProjectId, @ReleaseId, @ProjectGroupId, @TaskId, @TenantId, @DeployedBy, @DeployedToMachineIds, @Id, @Json)
We introduced a fix for this in 3.3.22, but since 3.4.0-beta0001 was released before that version, the fix wasn’t merged on it. It will be for sure in the next beta.
In the meantime, you can run the below script to make the same changes that were introduced in 3.3.22 to fix this. It was made so there’s not problem to run it more than once, so you won’t have a problem when you install the next beta (which will contain the same fix).