Symfony: The service ... has a dependency on a non-existent parameter kernel.secret

rich remer picture rich remer · May 16, 2014 · Viewed 10.8k times · Source

I'm trying to setup a new Symfony project. When I do a "php console.php config:dump-reference", I get an error saying 'The service "uri_signer" has a dependency on a non-existent parameter "kernel.secret". Did you mean this: "kernel.charset"?'

I have verified the secret is set in config/parameters.yml:

parameters:
    secret: s3kr3t

I have verified the parameters is imported in the config/config.yml:

imports:
    - { resource: parameters.yml }

If I change parameters.yml to the following it works (but this isn't correct, according to all documentation on the web):

parameters:
    kernel.secret: s3kr3t

Answer

Youri Thielen picture Youri Thielen · Jul 3, 2014

That means that kernel.secret hasn't been set, this value is used for generation of CSRF-tokens but could be used for other things as well.

Make sure kernel.secrect is known in parameters.yml and import it in config.yml as follows:

imports:
    - { resource: parameters.yml }

parameters.yml:

parameters:
    kernel.secret: ThisIsVerySecret!

Or how it's done in de standard edition:

config.yml:

framework:
    secret:          "%secret%"

parameters.yml

parameters:
     secret: ThisIsVerySecret!