Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-21255

Edit and save deployment environment notification (Webhooks) fails

      Issue Summary

      When editing a plan Webhooks notification without any changes, causes an error

      Steps to Reproduce

      1. Create a Webhooks notification in a deployment environment
      2. Edit the notification
      3. Make no change and save the notification

      Expected Results

      The notification setting pop up is closed

      Actual Results

      Page throws an exception

      An unexpected error has occurred
      org.springframework.dao.DataIntegrityViolationException: could not execute batch; SQL [insert into NOTIFICATIONS (RECIPIENT_TYPE, RECIPIENT, NOTIFICATION_SET, CONDITION_KEY, CONDITION_DATA, NOTIFICATION_RULE_ID) values (?, ?, ?, ?, ?, ?)]; constraint [notifications_unique]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute batch
      	at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:245)
      	at org.springframework.orm.hibernate5.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:802)
      	at org.springframework.orm.hibernate5.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:638)
      	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:746)
      	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714)
      	at sun.reflect.GeneratedMethodAccessor254.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:205)
      	at com.sun.proxy.$Proxy115.commit(Unknown Source)
      	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:534)
      	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:305)
      	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
      	at com.sun.proxy.$Proxy212.replaceNotification(Unknown Source)
      ...
      Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into NOTIFICATIONS (RECIPIENT_TYPE, RECIPIENT, NOTIFICATION_SET, CONDITION_KEY, CONDITION_DATA, NOTIFICATION_RULE_ID) values ('com.atlassian.bamboo.plugin.system.notifications:recipient.webhook', 'd2da5014-ca25-4bc3-a077-9f490359030f|https://webhook.site/446a8f1e-55ce-4bb3-8987-9dfbe6288a34', 655363, 'bamboo.deployments:deploymentStartedFinished', '', 819213) was aborted: ERROR: duplicate key value violates unique constraint "notifications_unique"
        Detail: Key (recipient_type, recipient, notification_set, condition_key, condition_data)=(com.atlassian.bamboo.plugin.system.notifications:recipient.webhook, d2da5014-ca25-4bc3-a077-9f490359030f|https://webhook.site/446a8f1e-55ce-4bb3-8987-9dfbe6288a34, 655363, bamboo.deployments:deploymentStartedFinished, ) already exists.  Call getNextException to see other errors in the batch.
      	at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:159)
      	at org.postgresql.core.ResultHandlerDelegate.handleError(ResultHandlerDelegate.java:50)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2268)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:510)
      	at org.postgresql.jdbc.PgStatement.internalExecuteBatch(PgStatement.java:851)
      	at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:874)
      	at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1563)
      	at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
      	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
      	at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:121)
      	... 305 more
      Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "notifications_unique"
        Detail: Key (recipient_type, recipient, notification_set, condition_key, condition_data)=(com.atlassian.bamboo.plugin.system.notifications:recipient.webhook, d2da5014-ca25-4bc3-a077-9f490359030f|https://webhook.site/446a8f1e-55ce-4bb3-8987-9dfbe6288a34, 655363, bamboo.deployments:deploymentStartedFinished, ) already exists.
      

      Workaround

      Ignore the error.

            [BAM-21255] Edit and save deployment environment notification (Webhooks) fails

            Jan Majkutewicz (Inactive) made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Waiting for Release [ 12075 ] New: Closed [ 6 ]
            Mateusz Szmal made changes -
            Fix Version/s New: 8.1.2 [ 99290 ]
            Mateusz Szmal made changes -
            Status Original: In Progress [ 3 ] New: Waiting for Release [ 12075 ]
            Mateusz Szmal made changes -
            Status Original: Long Term Backlog [ 12073 ] New: In Progress [ 3 ]
            Mateusz Szmal made changes -
            Assignee Original: Krzysztof Podsiadło [ 0ecd005f55dd ] New: Mateusz Szmal [ 851f15845f55 ]
            Zuzanna Struczewska made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 600083 ]
            Zuzanna Struczewska made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 599685 ]
            Krzysztof Podsiadło made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 596083 ]
            Krzysztof Podsiadło made changes -
            Assignee New: Krzysztof Podsiadło [ 0ecd005f55dd ]
            Krzysztof Podsiadło made changes -
            Remote Link New: This issue links to "+core+ Dogfooding › Test Git Branch Detection › BAM-21255-remove-error-message-when-updating-deployment-notification-with-no-changes (tardigrade-bamboo)" [ 595537 ]

              851f15845f55 Mateusz Szmal
              roliveira@atlassian.com Ricardo
              Affected customers:
              1 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: