Site with a customized wp-config.php location import fails, Local 2.4.3

A site having a Bedrock configuration https://roots.io/bedrock/ fails when importing in the newest Local. It was working before.

For the custom Bedrock structure, the nginx default web root location is changed. But since the import script fails when it does not find a wp-config.php file, it overwrites the backuped up nginx configuration files with the default ones and the import process stalls.

Here’s the relevant flywheel log entries:

Oct 24, 2018, 3:17 PM GMT+3 - info: [ImporterLocalExport] Importing SQL with myloader
Oct 24, 2018, 3:17 PM GMT+3 - info: [ImporterLocalExport] Setting SQL_MODE to 'NO_AUTO_VALUE_ON_ZERO'
Oct 24, 2018, 3:17 PM GMT+3 - info: [ImporterLocalExport] Resetting SQL_MODE to 
Oct 24, 2018, 3:17 PM GMT+3 - warn: [ImporterLocalExport] wp-config.php does not exist. Can't update DB info.
Oct 24, 2018, 3:17 PM GMT+3 - warn: [main/index] Unhandled Rejection at: Promise  Promise {
<rejected> TypeError: Cannot read property 'replace' of undefined
at SearchReplacerWPConfigDomain.replaceConstant (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:3904)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:4448
at Generator.next (<anonymous>)
at _0x45bf7f (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:2244)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:2594
at new Promise (<anonymous>)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:1994
at SearchReplacerWPConfigDomain.run (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:4609)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/Importer.js:1:15350
at Generator.next (<anonymous>)
at _0x387099 (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/Importer.js:1:6942)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/Importer.js:1:7329
at new Promise (<anonymous>)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/Importer.js:1:6747
at ImporterLocalExport.changeDomain (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/Importer.js:1:15390)
at addSite (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/ImporterLocalExport.js:1:2897)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7) }  reason:  TypeError: Cannot read property 'replace' of undefined
at SearchReplacerWPConfigDomain.replaceConstant (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:3904)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:4448
at Generator.next (<anonymous>)
at _0x45bf7f (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:2244)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:2594
at new Promise (<anonymous>)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:1994
at SearchReplacerWPConfigDomain.run (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/search-replacers/SearchReplacerWPConfigDomain.js:1:4609)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/Importer.js:1:15350
at Generator.next (<anonymous>)
at _0x387099 (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/Importer.js:1:6942)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/Importer.js:1:7329
at new Promise (<anonymous>)
at /Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/Importer.js:1:6747
at ImporterLocalExport.changeDomain (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/Importer.js:1:15390)
at addSite (/Applications/Local by Flywheel.app/Contents/Resources/app.asar/main/importers/ImporterLocalExport.js:1:2897)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)

Could you please fix the import script?

Or is there a workaround for that?

I’m trying to make this instructions to work again… https://github.com/artifex404/local-bedrock

@clay

I believe the fatal error during the import process is due to the new feature introduced in earlier Local version:

  • Local’s URL/domain search replacer will now replace WP_HOME , WP_SITEURL , and DOMAIN_CURRENT_SITE in wp-config.php

If the script fails to find-replace, it shouldn’t throw a fatal error to stall the whole process.

Hello! I’m experiencing the same thing. We use Sage and Bedrock to develop a lot of our sites, and it uses a custom setup regarding the WP configuration file. We do not use the import functionality, but when we are changing the hostname it seems like Local is trying to run the replace-feature to update the domain in the DB.

I hope that Local would add some checks so that it ignores this action if the wp-config.php-file is not present. This also goes for the feature “Sync Multi-site domains to Hosts file”. Local can’t grab the domains if it cannot access the DB-creds in the wp-config.php-file if the file does not exist.

God, I wish I could contribute to this app. It’s so good, just has a couple of flaws that makes the life of un-orthodox WP developers a bit more harder than it should be.

Kind regards,
Robert S.

Here is a screenshot of the error message.

1 Like