BUG: ERROR 503 after installing extensions from command line using composer

Keywords: Magento - Amazon Web Services/Google Cloud Platform - Technical issue - Other
bnsupport ID: 6cbdfb9f-0b31-ec27-2c2f-da5e97104162
Description: Bitnami Magento Error 503 Backend fetch failed - varnish - original topic

Confirmed on:
- Amazon Web Services with Magento 2.2.2-3
- Google Cloud Platform with Magento 2.2.2-1

Steps To Reproduce:

Installing extension from the command line (e.g.):

composer require mailchimp/mc-magento2:1.0.25
bin/magento setup:upgrade

Expected result:

Installed extension.

Actual result:

Whole Magento store is down.
HTTP "Error 503 Backend fetch failed" showing on every page.
HTTPS Not loading webpages or loading only home page very slow.
Not possible to access admin/login
High CPU usage (cron)

Additional Info:

composer has no access to create cache dir's while installing extensions:

Cannot create cache directory /opt/bitnami/php/composer/cache/repo/https---repo.magento.com/, or directory is not writable. Proceeding without cache
Cannot create cache directory /opt/bitnami/php/composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /opt/bitnami/php/composer/cache/files/, or directory is not writable. Proceeding without cache
Warning: This development build of composer is over 60 days old. It is recommended to update it by running "/opt/bitnami/php/bin/composer.phar self-update" to get the latest version.
./composer.json has been updated
Cannot create cache directory /opt/bitnami/php/composer/cache/repo/https---repo.magento.com/, or directory is not writable. Proceeding without cache
Cannot create cache directory /opt/bitnami/php/composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /opt/bitnami/php/composer/cache/files/, or directory is not writable. Proceeding without cache

error while updating composer:

/opt/bitnami/php/bin/composer.phar self-update

Cannot create cache directory /opt/bitnami/php/composer/cache/repo/https---repo.magento.com/, or directory is not writable. Proceeding without cache
Cannot create cache directory /opt/bitnami/php/composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /opt/bitnami/php/composer/cache/files/, or directory is not writable. Proceeding without cache


  [Composer\Downloader\FilesystemException]
  Filesystem exception:
  Composer update failed: the "/opt/bitnami/php/composer/cache" directory used to download the temp file could not be written

Hi,

I was able to reproduce the issue. I will forward the case so it can be analyzed in more detail. Thanks for reporting.

Best regards,
Silvio Fernández

did you find a solution to this bug ?
same problem with last bitnami magento 2.2-3 with google cloud
crash frontend and backend after installing extension from command line :frowning:

1 Like

Hi,

we created the task and it's in the pipeline but we can't provide them with an estimation. In case we have some time next week, we will include it to provide a fix for that.

Best regards,
Silvio Fernández

Unfortunately not. it's over a week now and no solution. I'm happy I find this out in the early stage of using Bitnami instances. I don't want to know what if this was my store in production mode. Or what if something else will come up at a later time... no help and store down for ages.....

That's why I went somewhere else and I'm surprised those instances are still available to use, even without the warning for users...

If the magento is switched to the mode developer, you can see page error 503. My solution that helps me is as follows: in root give the following commands:

cd /opt/bitnami/apps/magento/htdocs
php bin/magento cache:enable
php bin/magento cache:clean
rm -rf var/cache/*
sudo /opt/bitnami/ctlscript.sh restart varnish

Hi @regtonltd

I just tried @eduard workaround and it seems to work. Please try it while we fix the issue on the stack.

We increased the priority of the task and we hope to have this fixed asap. Please note that our engineering team provides service for many different stacks, and we are working hard to improve the user experience on every one of them. Thanks in advance for your consideration and patience. We will notify you about our progress.

PD: @eduard I edited your response to format the code.

Best Regards,

Juan Ariza

Thanks, I did try it as well and end up with this after login into the back end:

1 exception(s):
Exception #0 (RuntimeException): Could not read /opt/bitnami/apps/magento/htdocs/auth.json

Warning: file_get_contents(/opt/bitnami/apps/magento/htdocs/auth.json): failed to open stream: Permission denied in /opt/bitnami/apps/magento/htdocs/vendor/composer/composer/src/Composer/Json/JsonFile.php on line 93

Exception #0 (RuntimeException): Could not read /opt/bitnami/apps/magento/htdocs/auth.json

Warning: file_get_contents(/opt/bitnami/apps/magento/htdocs/auth.json): failed to open stream: Permission denied in /opt/bitnami/apps/magento/htdocs/vendor/composer/composer/src/Composer/Json/JsonFile.php on line 93
#0 /opt/bitnami/apps/magento/htdocs/vendor/composer/composer/src/Composer/Factory.php(309): Composer\Json\JsonFile->read()
#1 /opt/bitnami/apps/magento/htdocs/vendor/composer/composer/src/Composer/Factory.php(569): Composer\Factory->createComposer(Object(Composer\IO\BufferIO), Array, false)
#2 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Composer/ComposerFactory.php(47): Composer\Factory::create(Object(Composer\IO\BufferIO), '/opt/bitnami/ap...')
#3 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Composer/ComposerInformation.php(362): Magento\Framework\Composer\ComposerFactory->create()
#4 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Composer/ComposerInformation.php(375): Magento\Framework\Composer\ComposerInformation->getComposer()
#5 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Composer/ComposerInformation.php(242): Magento\Framework\Composer\ComposerInformation->getLocker()
#6 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/App/ProductMetadata.php(104): Magento\Framework\Composer\ComposerInformation->getSystemPackages()
#7 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/App/ProductMetadata.php(65): Magento\Framework\App\ProductMetadata->getSystemPackageVersion()
#8 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-admin-notification/Model/Feed.php(210): Magento\Framework\App\ProductMetadata->getVersion()
#9 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-admin-notification/Model/Feed.php(140): Magento\AdminNotification\Model\Feed->getFeedData()
#10 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-admin-notification/Observer/PredispatchAdminActionControllerObserver.php(51): Magento\AdminNotification\Model\Feed->checkUpdate()
#11 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Event/Invoker/InvokerDefault.php(72): Magento\AdminNotification\Observer\PredispatchAdminActionControllerObserver->execute(Object(Magento\Framework\Event\Observer))
#12 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Event/Invoker/InvokerDefault.php(60): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\AdminNotification\Observer\PredispatchAdminActionControllerObserver), Object(Magento\Framework\Event\Observer))
#13 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))
#14 /opt/bitnami/apps/magento/htdocs/generated/code/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('controller_acti...', Array)
#15 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/App/Action/Action.php(96): Magento\Framework\Event\Manager\Proxy->dispatch('controller_acti...', Array)
#16 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-backend/App/AbstractAction.php(229): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#17 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#18 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Backend\Controller\Adminhtml\Dashboard\Index\Interceptor->___callParent('dispatch', Array)
#19 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Backend\Controller\Adminhtml\Dashboard\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#20 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Backend\Controller\Adminhtml\Dashboard\Index\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#21 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Backend\Controller\Adminhtml\Dashboard\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#22 /opt/bitnami/apps/magento/htdocs/generated/code/Magento/Backend/Controller/Adminhtml/Dashboard/Index/Interceptor.php(39): Magento\Backend\Controller\Adminhtml\Dashboard\Index\Interceptor->___callPlugins('dispatch', Array, NULL)
#23 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/App/FrontController.php(55): Magento\Backend\Controller\Adminhtml\Dashboard\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#24 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#25 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#26 [internal function]: Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#27 /opt/bitnami/apps/magento/htdocs/vendor/m2e/ebay-amazon-magento2/Plugin/AbstractPlugin.php(34): call_user_func_array(Object(Closure), Array)
#28 /opt/bitnami/apps/magento/htdocs/vendor/m2e/ebay-amazon-magento2/Plugin/HealthStatus/Magento/Framework/App/FrontController.php(42): Ess\M2ePro\Plugin\AbstractPlugin->execute('dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Array)
#29 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(135): Ess\M2ePro\Plugin\HealthStatus\Magento\Framework\App\FrontController->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#30 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#31 /opt/bitnami/apps/magento/htdocs/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)
#32 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#33 /opt/bitnami/apps/magento/htdocs/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#34 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()
#35 /opt/bitnami/apps/magento/htdocs/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#36 {main}

Hi,

Which user did you use to execute the command @jariza suggest you? Could you please check the permissions of the file /opt/bitnami/apps/magento/htdocs/auth.json executing ls -la /opt/bitnami/apps/magento/htdocs/auth.json. It seems that you execute the commando using you own user instead of bitnami one. Prior to executing any command on a Bitnami stack using Google Compute Engine you must switch to the bitnami user executing sudo su bitnami.

If the case was related with a wrong user, you could fix it by reverting to their correct user-group, sudo chown -R bitnami:daemon /opt/bitnami/apps/magento/htdocs/

Hope it helps.

Best regards,
Silvio Fernández

I do only use bitnami as an user

bitnami@ddl-m2-vm:~$ ls -la /opt/bitnami/apps/magento/htdocs/auth.json
-rw------- 1 bitnami daemon 314 Jan 23 11:25 /opt/bitnami/apps/magento/htdocs/auth.json

I did also tried to fixx all permitions by using:

/opt/bitnami/apps/magento/scripts/fixPermissions.sh

full list of permitions:

drwxrwxr-x 14 bitnami daemon   4096 Jan 23 22:57 .
drwxr-xr-x  6 root    root     4096 Jan 11 17:20 ..
drwxr-xr-x  5 bitnami daemon   4096 Jan 11 17:12 app
-rw-------  1 bitnami daemon    314 Jan 23 11:25 auth.json
-rw-r--r--  1 bitnami daemon    138 Dec 13 00:28 auth.json.sample
drwxr-xr-x  2 bitnami daemon   4096 Jan 11 17:12 bin
-rw-r--r--  1 bitnami daemon 566648 Dec 13 00:28 CHANGELOG.md
-rw-r--r--  1 bitnami daemon   2263 Jan 23 11:26 composer.json
-rw-r--r--  1 bitnami daemon 449073 Jan 23 11:26 composer.lock
-rw-r--r--  1 bitnami daemon   3671 Dec 13 00:28 CONTRIBUTING.md
-rw-r--r--  1 bitnami daemon    647 Dec 13 00:28 COPYING.txt
drwxr-xr-x  5 bitnami daemon   4096 Jan 11 17:13 dev
drwxr-xr-x  4 bitnami daemon   4096 Jan 23 15:11 generated
-rw-r--r--  1 bitnami daemon   1437 Dec 11 17:59 .gitignore
-rw-r--r--  1 bitnami daemon     57 Dec 13 00:28 grunt-config.json.sample
-rw-r--r--  1 bitnami daemon   2994 Dec 13 00:28 Gruntfile.js.sample
-rw-r--r--  1 bitnami daemon  12098 Jan 11 17:18 .htaccess
-rw-r--r--  1 bitnami daemon  11475 Dec 13 00:28 .htaccess.sample
-rw-r--r--  1 bitnami daemon   1370 Dec 13 00:28 index.php
-rw-r--r--  1 bitnami daemon    691 Dec 13 00:28 ISSUE_TEMPLATE.md
drwxr-xr-x  4 bitnami daemon   4096 Jan 11 17:12 lib
-rw-r--r--  1 bitnami daemon  10376 Dec 13 00:28 LICENSE_AFL.txt
-rw-r--r--  1 bitnami daemon  10364 Dec 13 00:28 LICENSE.txt
-rw-r--r--  1 bitnami daemon   5531 Dec 13 00:28 nginx.conf.sample
-rw-r--r--  1 bitnami daemon   1415 Dec 13 00:28 package.json.sample
-rw-r--r--  1 bitnami daemon   1757 Dec 13 00:28 .php_cs.dist
-rw-r--r--  1 bitnami daemon    804 Dec 13 00:28 php.ini.sample
drwxr-xr-x  2 bitnami daemon   4096 Jan 11 17:12 phpserver
drwxr-xr-x  6 bitnami daemon   4096 Jan 11 17:13 pub
-rw-r--r--  1 bitnami daemon    804 Dec 13 00:28 PULL_REQUEST_TEMPLATE.md
drwxr-xr-x  7 bitnami daemon   4096 Jan 11 17:12 setup
drwxr-xr-x  2 bitnami daemon   4096 Jan 23 12:07 temp
-rw-r--r--  1 bitnami daemon   1820 Dec 13 00:28 .travis.yml
drwxr-xr-x  7 bitnami daemon   4096 Jan 11 17:12 update
-rw-r--r--  1 bitnami daemon    101 Dec 13 00:28 .user.ini
drwxrwsr-x  9 bitnami daemon   4096 Feb  6 12:05 var
drwxrwsr-x 47 bitnami daemon   4096 Jan 23 11:26 vendor

Hi,

Could you try to give read permission to the auth.json file in the user daemon sudo chmod g+r auth.json, then restart servers and check again. If this does not work, try to give it read and writing permissions sudo chmod g+rw and restart the servers sudo /opt/bitnami/ctlscript.sh restart

Best regards,
Silvio Fernández

Hi.

It seems that has fixed it now. front and back pages responding, can login to backend without the issues. So all seems to be fine. Thank you.

Hi,

We are glad that you were able to fix the issue.

If you have any other question and you think we can help, please don’t hesitate to ask.

Best regards,
Silvio Fernández

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.