Roots Discourse

FIXED: Production deploy Dotenv must be an instance of RepositoryInterface error

Hello,

I a running the latest version of Trellis and I am not getting a strange error that I didn’t had before.

When I run ./bin/deploy.sh production example.com I get this:

TASK [deploy : WordPress Installed?] ******************************************************************************************************************************************************************************************************************************************************
System info:
  Ansible 2.8.0; Darwin
  Trellis Head
---------------------------------------------------
non-zero return code
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to
Dotenv\Dotenv::create() must be an instance of
Dotenv\Repository\RepositoryInterface, string given, called in /srv/www/widew
orldtravelers.com/releases/20200204095658/config/application.php on line 27
and defined in /srv/www/example.com/releases/20200204095658/vendor
/vlucas/phpdotenv/src/Dotenv.php:62
Stack trace:
#0 /srv/www/example.com/releases/20200204095658/config/application
.php(27): Dotenv\Dotenv::create('/srv/www/widewo...')
#1 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1150) :
eval()'d code(7): require_once('/srv/www/widewo...')
#2 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1150):
eval()
#3 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1111):
WP_CLI\Runner->load_wordpress()
#4 phar:///usr/bin/wp/vendor/wp-cli/wp-
cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#5 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(74):
WP_CLI\Bootstrap\LaunchRunner->process(Obj in /srv/www/example.com
/releases/20200204095658/vendor/vlucas/phpdotenv/src/Dotenv.php on line 62
fatal: [111.111.111.111]: FAILED! => {"changed": false, "cmd": ["wp", "core", "is-installed", "--skip-plugins", "--skip-themes", "--require=/srv/www/example.com/shared/tmp_multisite_constants.php"], "delta": "0:00:00.112706", "end": "2020-02-04 09:57:16.114410", "failed_when_result": true, "rc": 255, "start": "2020-02-04 09:57:16.001704", "stderr_lines": ["PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Dotenv\\Dotenv::create() must be an instance of Dotenv\\Repository\\RepositoryInterface, string given, called in /srv/www/example.com/releases/20200204095658/config/application.php on line 27 and defined in /srv/www/example.com/releases/20200204095658/vendor/vlucas/phpdotenv/src/Dotenv.php:62", "Stack trace:", "#0 /srv/www/example.com/releases/20200204095658/config/application.php(27): Dotenv\\Dotenv::create('/srv/www/widewo...')", "#1 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1150) : eval()'d code(7): require_once('/srv/www/widewo...')", "#2 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1150): eval()", "#3 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1111): WP_CLI\\Runner->load_wordpress()", "#4 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\\Runner->start()", "#5 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(74): WP_CLI\\Bootstrap\\LaunchRunner->process(Obj in /srv/www/example.com/releases/20200204095658/vendor/vlucas/phpdotenv/src/Dotenv.php on line 62"], "stdout": "", "stdout_lines": []}

PLAY RECAP ********************************************************************************************************************************************************************************************************************************************************************************
111.111.111.111               : ok=22   changed=10   unreachable=0    failed=1    skipped=24   rescued=0    ignored=0
localhost                  : ok=0    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0

I have obfuscated the domain name and IP.

Not sure where to start to debug the issue as my PHP is very rusty. Has anyone seen this before?

Thank you for your help.

My problem was that I bumped the version of “vlucas/phpdotenv” from 3 to 4 and that broke it :slight_smile:

Perhaps this post could help others as noob as me.

Bedrock doesn’t support vlucas/phpdotenv v4 yet.

For those facing the same issue:

This topic was automatically closed after 42 days. New replies are no longer allowed.