fix(core): Prevent workflow history saving error from happening (#7812)
When performing actions such as renaming a workflow or updating its settings, n8n errors with "Failed to save workflow version" in the console although the saving process was successful. We are now correctly checking whether `nodes` and `connections` exist and only then save a snapshot. Github issue / Community forum post (link here to close automatically):
This commit is contained in:
@@ -66,7 +66,10 @@ export class WorkflowHistoryService {
|
||||
}
|
||||
|
||||
async saveVersion(user: User, workflow: WorkflowEntity, workflowId: string) {
|
||||
if (isWorkflowHistoryEnabled()) {
|
||||
// On some update scenarios, `nodes` and `connections` are missing, such as when
|
||||
// changing workflow settings or renaming. In these cases, we don't want to save
|
||||
// a new version
|
||||
if (isWorkflowHistoryEnabled() && workflow.nodes && workflow.connections) {
|
||||
try {
|
||||
await this.workflowHistoryRepository.insert({
|
||||
authors: user.firstName + ' ' + user.lastName,
|
||||
|
||||
Reference in New Issue
Block a user