cancel
Showing results for 
Search instead for 
Did you mean: 

Checkout error when Observer enabled

Checkout error when Observer enabled

I have been trying to fix this issue for the last couple of days and slowly running out of ideas.

Background:

I have written a custom observer, which should update some Jira CustomFields. Currently it should just write into /var/log/xxx.log instead

Issue:

- When checking out a cart without enabling the custom observer, everything works fine and an order is placed successfully

- When trying to check out with the custom observer enabled, i can not place the order and an error is shown after clicking on "place order". The event is thrown and the observer actully writes into the file, but I'm stuck at the "xxx.shop/checkout/#payment" place order section

 

So sth has to be wrong with the observer, but I'm unsure what it is. These are my files:

 

/etc/webapi_rest/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="checkout_submit_all_after">
        <observer name="JiraConfirmationUpdate" instance="one\two\Observer\JiraConfirmationUpdate" />
    </event>
    <event name="checkout_cart_add_product_complete">
        <observer name="JiraGetAttachments" instance="one\two\Observer\JiraGetAttachments" />
    </event>
</config>

 

Observer/JiraConfirmationUpdate.php

<?php

namespace one\two\Observer;


class JiraConfirmationUpdate implements \Magento\Framework\Event\ObserverInterface
{
  public function __construct()
  {

  }
  public function execute(\Magento\Framework\Event\Observer $observer)
  {
  $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/confirmation.log');
        $logger = new \Zend\Log\Logger();
        $logger->addWriter($writer);
        $logger->info("JiraConfirmationUpdate");

  }
}

?>

Does anyone have an idea what the reason could be?

 

EDIT

I just found out that the order is actually placed but the customer will still get an error with no message...