I just upgraded from Symfony 4.2 to 4.4. I'm using vich uploader bundle. In the the vich_uploader.yaml I'm getting the following error during cache cleaning or attempting to access the application via browser:
The file ".../config/packages/vich_uploader.yaml" does not contain valid YAML: The reserved indicator "%" cannot start a plain scalar; you need to quote the scalar at line 7 (near "uri_prefix: '%env(resolve:MAP_URI_FOLDER_LOCATION)%' ") in .../config/packages/vich_uploader.yaml (which is loaded in resource ".../config/packages/vich_uploader.yaml").
However, I already have quotes around yaml. Here's the vich_uploader.yaml:
vich_uploader:
db_driver: orm
mappings:
event_map_image:
uri_prefix: '%env(MAP_URI_FOLDER_LOCATION)%'
namer: Vich\UploaderBundle\Naming\OrignameNamer
upload_destination: '%kernel.project_dir%%env(MAP_FILE_ROUTE_FROM_PROJECT_DIR)%'
inject_on_load: false
delete_on_update: true
delete_on_remove: true
event_schedule_upload:
uri_prefix: '%env(SCHEDULE_FILE_URI_PREFIX)%'
namer: Vich\UploaderBundle\Naming\OrignameNamer
upload_destination: '%kernel.project_dir%%env(SCHEDULE_FILE_ROUTE_FROM_PROJECT_DIR)%'
inject_on_load: false
delete_on_update: true
delete_on_remove: true
I can provide cleaned pertinent variables of the .env file:
MAP_URI_FOLDER_LOCATION="http://localhost:8000/web/uploads/maps"
SCHEDULE_FILE_URI_PREFIX="http://localhost:8000/web/uploads/schedules"
MAP_FILE_ROUTE_FROM_PROJECT_DIR="/public/web/uploads/maps"
SCHEDULE_FILE_ROUTE_FROM_PROJECT_DIR="/public/web/uploads/schedules"
This is per Symfony's instructions and everything I can find on yaml. What am I missing in this quoting? Or would something cause the error do to conflicting packages in the Symfony Upgrade? As stated, I'm upgrading from 4.2 to 4.4 and have many moving parts there. Thanks.
After the upgrade, I went through all the recipe upgrades according to advice at Symfony Docs: Upgrading a Major Version.... This seems to have fixed the problem. I'm not sure why since the vich_uploader bundle wasn't upgraded and there was no recipe upgrade for it. It must have been some sort of config conflict with Symfony 4.4.
Note: The final quotes are as shown in the original question (i.e., single quotes in the yaml file work. Double quotes do not work.).