When setting up, if the private key file is not readable, then on switching to the settings tab you get:

Warning: file_get_contents(/home/jeff/projects/artspro/d8/keys/xero_demo_privkey.pex): failed to open stream: Permission denied in GuzzleHttp\Subscriber\Oauth\Oauth1->signUsingRsaSha1() (line 261 of /home/jeff/projects/artspro/d8/vendor/guzzlehttp/oauth-subscriber/src/Oauth1.php).
GuzzleHttp\Subscriber\Oauth\Oauth1->signUsingRsaSha1('GET&https%3A%2F%2Fapi.xero.com%2Fapi.xro%2F2.0%2FAccounts&oauth_consumer_key%3DVENU8TXLLY7BYISSMBSEFYWQTBQRAB%26oauth_nonce%3Dabe6308634a730a6aa0cd0590a371beaf924587a%26oauth_signature_method%3DRSA-SHA1%26oauth_timestamp%3D1568160496%26oauth_token%3DVENU8TXLLY7BYISSMBSEFYWQTBQRAB%26oauth_version%3D1.0') (Line: 161)
GuzzleHttp\Subscriber\Oauth\Oauth1->getSignature(Object, Array) (Line: 101)
GuzzleHttp\Subscriber\Oauth\Oauth1->onBefore(Object) (Line: 87)
GuzzleHttp\Subscriber\Oauth\Oauth1->GuzzleHttp\Subscriber\Oauth\{closure}(Object, Array) (Line: 37)
GuzzleHttp\PrepareBodyMiddleware->__invoke(Object, Array) (Line: 30)
GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object, Array) (Line: 70)
GuzzleHttp\RedirectMiddleware->__invoke(Object, Array) (Line: 60)
GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object, Array) (Line: 67)
GuzzleHttp\HandlerStack->__invoke(Object, Array) (Line: 277)
GuzzleHttp\Client->transfer(Object, Array) (Line: 125)
GuzzleHttp\Client->requestAsync('get', Object, Array) (Line: 131)
GuzzleHttp\Client->request('get', 'Accounts', Array) (Line: 89)
GuzzleHttp\Client->__call('get', Array) (Line: 503)
Drupal\xero\XeroQuery->execute() (Line: 552)
Drupal\xero\XeroQuery->getCache('xero_account') (Line: 69)
Drupal\xero\Form\DefaultSettingsForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 519)
Drupal\Core\Form\FormBuilder->retrieveForm('xero_default_settings_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: openssl_sign(): supplied key param cannot be coerced into a private key in GuzzleHttp\Subscriber\Oauth\Oauth1->signUsingRsaSha1() (line 266 of /home/jeff/projects/artspro/d8/vendor/guzzlehttp/oauth-subscriber/src/Oauth1.php).
GuzzleHttp\Subscriber\Oauth\Oauth1->signUsingRsaSha1('GET&https%3A%2F%2Fapi.xero.com%2Fapi.xro%2F2.0%2FAccounts&oauth_consumer_key%3DVENU8TXLLY7BYISSMBSEFYWQTBQRAB%26oauth_nonce%3Dabe6308634a730a6aa0cd0590a371beaf924587a%26oauth_signature_method%3DRSA-SHA1%26oauth_timestamp%3D1568160496%26oauth_token%3DVENU8TXLLY7BYISSMBSEFYWQTBQRAB%26oauth_version%3D1.0') (Line: 161)
GuzzleHttp\Subscriber\Oauth\Oauth1->getSignature(Object, Array) (Line: 101)
GuzzleHttp\Subscriber\Oauth\Oauth1->onBefore(Object) (Line: 87)
GuzzleHttp\Subscriber\Oauth\Oauth1->GuzzleHttp\Subscriber\Oauth\{closure}(Object, Array) (Line: 37)
GuzzleHttp\PrepareBodyMiddleware->__invoke(Object, Array) (Line: 30)
GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object, Array) (Line: 70)
GuzzleHttp\RedirectMiddleware->__invoke(Object, Array) (Line: 60)
GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object, Array) (Line: 67)
GuzzleHttp\HandlerStack->__invoke(Object, Array) (Line: 277)
GuzzleHttp\Client->transfer(Object, Array) (Line: 125)
GuzzleHttp\Client->requestAsync('get', Object, Array) (Line: 131)
GuzzleHttp\Client->request('get', 'Accounts', Array) (Line: 89)
GuzzleHttp\Client->__call('get', Array) (Line: 503)
Drupal\xero\XeroQuery->execute() (Line: 552)
Drupal\xero\XeroQuery->getCache('xero_account') (Line: 69)
Drupal\xero\Form\DefaultSettingsForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 519)
Drupal\Core\Form\FormBuilder->retrieveForm('xero_default_settings_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: openssl_free_key() expects parameter 1 to be resource, boolean given in GuzzleHttp\Subscriber\Oauth\Oauth1->signUsingRsaSha1() (line 267 of /home/jeff/projects/artspro/d8/vendor/guzzlehttp/oauth-subscriber/src/Oauth1.php).
GuzzleHttp\Subscriber\Oauth\Oauth1->signUsingRsaSha1('GET&https%3A%2F%2Fapi.xero.com%2Fapi.xro%2F2.0%2FAccounts&oauth_consumer_key%3DVENU8TXLLY7BYISSMBSEFYWQTBQRAB%26oauth_nonce%3Dabe6308634a730a6aa0cd0590a371beaf924587a%26oauth_signature_method%3DRSA-SHA1%26oauth_timestamp%3D1568160496%26oauth_token%3DVENU8TXLLY7BYISSMBSEFYWQTBQRAB%26oauth_version%3D1.0') (Line: 161)
GuzzleHttp\Subscriber\Oauth\Oauth1->getSignature(Object, Array) (Line: 101)
GuzzleHttp\Subscriber\Oauth\Oauth1->onBefore(Object) (Line: 87)
GuzzleHttp\Subscriber\Oauth\Oauth1->GuzzleHttp\Subscriber\Oauth\{closure}(Object, Array) (Line: 37)
GuzzleHttp\PrepareBodyMiddleware->__invoke(Object, Array) (Line: 30)
GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object, Array) (Line: 70)
GuzzleHttp\RedirectMiddleware->__invoke(Object, Array) (Line: 60)
GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object, Array) (Line: 67)
GuzzleHttp\HandlerStack->__invoke(Object, Array) (Line: 277)
GuzzleHttp\Client->transfer(Object, Array) (Line: 125)
GuzzleHttp\Client->requestAsync('get', Object, Array) (Line: 131)
GuzzleHttp\Client->request('get', 'Accounts', Array) (Line: 89)
GuzzleHttp\Client->__call('get', Array) (Line: 503)
Drupal\xero\XeroQuery->execute() (Line: 552)
Drupal\xero\XeroQuery->getCache('xero_account') (Line: 69)
Drupal\xero\Form\DefaultSettingsForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 519)
Drupal\Core\Form\FormBuilder->retrieveForm('xero_default_settings_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: Invalid argument supplied for foreach() in Drupal\xero\Form\DefaultSettingsForm->buildForm() (line 71 of modules/contrib/xero/src/Form/DefaultSettingsForm.php).
Drupal\xero\Form\DefaultSettingsForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 519)
Drupal\Core\Form\FormBuilder->retrieveForm('xero_default_settings_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Suggest you check for readabilty on Save, and generate a warning instead.

Comments

Jeff Veit created an issue. See original summary.

mradcliffe’s picture

This should be throwing an InvalidOptionsException in XeroClient when instantiating the client object. It should check if the path exists via realpath, and if it doesn't, then it should throw that exception. I'm not sure why it's not getting caught, but I'd probably fix that in xeroclient (and a fallback here in the module).

Thank you for reporting this.

  • mradcliffe committed 0e0577e on 8.x-1.x
    Issue #3080491 by mradcliffe, Jeff Veit: Updates xeroclient to 0.2.0 to...
mradcliffe’s picture

Version: 8.x-1.2-alpha6 » 8.x-1.x-dev
Component: Code » XeroClient
Status: Active » Fixed

Fixed upstream in mradcliffe/xeroclient with tests in 0.2.0 version.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.