Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twig error on all s3 volume's settings pages in CP after Craft 3 migration #47

Closed
louderthan10 opened this issue Feb 26, 2019 · 11 comments
Assignees

Comments

@louderthan10
Copy link

Hi gang. Hitting a Twig bug with this version after migrating from Craft 2. After performing an upgrade, then installing the S3 plugin, when I go to any of my S3 Asset volume's settings pages in the CP, I get the following Twig error:

Twig Runtime Error – Twig_Error_Runtime
Key "1" for array with keys "0" does not exist.

    1. in /vendor/craftcms/aws-s3/src/templates/volumeSettings.html at line 125

                                  id: 'expiresAmount',
                    value: expires[0],
                    size: 2,
                    class: 's3-expires-amount'
                }) }}
            </div>
            {{ forms.select({
                id: 'expiresPeriod',
                options: periods,
                value: expires[1],
                class: 's3-expires-period'
            }) }}
        </div>
        {{ forms.hidden({
            name: "expires",
            value: volume.expires,
            class: "expires-combined"
        }) }}
    {% endset %}

Steps to reproduce

  1. Deploy updated files/templates/configs for Craft 3
  2. Run composer install
  3. Perform Craft 3 upgrade (everything works)
  4. Enable S3 plugin from Plugins page in CP
  5. Click on any S3 volume in the Assets section of the CP (non-S3 volumes load fine)

Versions

Craft: 2.7.5 - 3.1.14
S3: 1.2.0

@toyflish
Copy link

toyflish commented Mar 4, 2019

I have the same error. There is is a key with wrong expires-date-format migrated to your config/project.yaml

volumes:
  [cryptic-volume-id]:
    settings:
      expires: 31days

the plugin expects 31days to be seperated by space "31 days"

    {% set expires = (volume.expires|length > 0 ? volume.expires|split(' ') : ['', ''])%}

after changing project.yaml the new config has to be loaded in the browser. Is there a way to trigger this with the ./craft cli ?

@andris-sevcenko
Copy link
Contributor

Not sure how this could have happened, but released 1.2.1 version of this plugin which includes a migration that fixes the corrupted config.

@jamesmacwhite
Copy link

jamesmacwhite commented Mar 6, 2019

@andris-sevcenko I've also just experienced this on a Craft 2 to Craft 3 migration. However I am running the 1.2.1 release which has the migration but still get the twig error. In my case my project.yaml has expires: 1months set for each S3 asset volume after the upgrade.

Changing the expires value to 1 months for all S3 asset locations seems to work.

@louderthan10
Copy link
Author

Seems to work for me now, thanks!

@andris-sevcenko
Copy link
Contributor

@jamesmacwhite if you have a pre-update DB backup, I'd love to be able to look at the dump of the craft_volumes table. Obviously, redact any and all access keys and other info.

If it's possible, can you send that over to support@craftcms.com and reference this thread?

@jamesmacwhite
Copy link

@andris-sevcenko Absolutely. I will provide that to you for further investigation.

@jamesmacwhite
Copy link

jamesmacwhite commented Mar 7, 2019

@andris-sevcenko Just to confirm. Do you want the DB backup after a Craft 2 migration but before the AWS plugin is installed?

@andris-sevcenko
Copy link
Contributor

@jamesmacwhite yup, that would work! If I'll need something else, I'll let you know!

@jamesmacwhite
Copy link

@andris-sevcenko Understood, I will perform a Craft 2 to 3 migration for this requirement and give you the table data required.

@jamesmacwhite
Copy link

@andris-sevcenko Just to let you know. I have provided the craft_volumes table to support@craftcms.com for further analysis. If you'd like anything else, please let me know. As I am currently working on migrating the existing Craft 2 project, I have plenty of regularly DB backups!

@louderthan10
Copy link
Author

louderthan10 commented Mar 21, 2019

Just a little update on this after doing a few upgrade dry runs.

If I update from Craft 2 > Craft 3, then enable the plugin at 1.2.1, it still errors.

If I update from Craft 2 > Craft 3, enable the plugin at 1.1.3 (errors), then upgrade to 1.2.1, it works.

andris-sevcenko added a commit that referenced this issue Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants