Skip to content

Access token is required even if handler configuration parameter is set #469

@SimonFoskolos

Description

@SimonFoskolos
  • rollbar/rollbar-php-symfony-bundle v3.1.2
  • rollbar/rollbar v1.7.4

We recently changed our Rollbar configuration so that it uses fluentd td-agent for logging errors. So we added :

handler: fluent
fluent_tag: identifier_for_component_logging_to_rollbar

to the configuration file and of course removed the access_token variable as it is no longer needed since this is now added to the configuration file of the td-agent daemon. However running composer install fails with:

In Utilities.php line 25:                                                                                                                                            
                                                                                                                                                                       
    $config['access_token'] must not be null                                                                                                                           
                                                                                                                                                                       
  In Utilities.php line 25:                                                                                                                                            
                                                                                                                                                                       
    $config['access_token'] must not be null                                                                                                                           
                                                                                                                                                                       

Adding a false access token resolves this issue, and of course Rollbar works as expected.

Wouldn't it make more sense to check if fluent handler is used and if so, to not call the

private function setAccessToken($config)
    {
        if (isset($_ENV['ROLLBAR_ACCESS_TOKEN']) && !isset($config['access_token'])) {
            $config['access_token'] = $_ENV['ROLLBAR_ACCESS_TOKEN'];
        }
        $this->utilities->validateString($config['access_token'], "config['access_token']", 32, false);
        $this->accessToken = $config['access_token'];
    }

method which in turn calls the validateString method that generates this error ?

Metadata

Metadata

Assignees

Labels

Type: BugFix a component so that its behavior aligns with its documentation.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions