timmyomahony / craft-remote-sync

Sync your database and assets across Craft environments using a remote destination like AWS S3
https://plugins.craftcms.com/remote-sync
Other
12 stars 4 forks source link

Error Fetching Databases - Undefined Offset #26

Closed iamstevemckinney closed 3 years ago

iamstevemckinney commented 3 years ago

When trying to view the utility from the control panel I see "Error Fetching Databases". However, while pushing the database doesn't remove the error I can see the files show up in the S3 control panel. Running the command line remote-sync/database/push successfully runs, but remote-sync/database/list returns Error: Undefined offset: 1.

I can provide more of my log if need be, but the error there is yii\base\ErrorException: Undefined offset: 1 in /Users/steve/documents/git/mvcu/vendor/weareferal/remote-sync/src/services/RemoteSyncService.php:43

It is otherwise a new empty bucket and I have not touched any file in the bucket outside of running this plugin.

iamstevemckinney commented 3 years ago

I think i've determined this is due to using the craft 3.5 beta. The .sql file name is mvcu_dev_200708_152822_syhmcainxf_v3.5.0-beta.3.sql and the regex in RemoteSyncInstance fails with -beta.3 in the filename, but otherwise returns matches without it.

timmyomahony commented 3 years ago

Thanks @iamstevemckinney yep I've encountered this error before with other issues relating to the file name. I'll update the regex but it it might make sense to try catch exceptions with the regex instead of crashing to prevent these kind of errors in the future

timmyomahony commented 3 years ago

Updated in 1.4.0 to be more forgiving https://github.com/weareferal/craft-remote-sync/commit/1f2f7bd00e6b01a99b02c2fba4da673dfed8258d