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

[BUG] Composer install fails only when APP_ENV=prod #99

Open
1 of 3 tasks
sterichards opened this issue Jul 24, 2021 · 1 comment
Open
1 of 3 tasks

[BUG] Composer install fails only when APP_ENV=prod #99

sterichards opened this issue Jul 24, 2021 · 1 comment
Assignees
Labels

Comments

@sterichards
Copy link

sterichards commented Jul 24, 2021

Describe the bug

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  
!!  Fatal error: Uncaught TypeError: Maxbanton\Cwh\Handler\CloudWatch::__construct(): Argument #6 ($tags) must be of type array, string given, called in /var/www/html/var/cache/prod/ContainerU7jBHOL/App_KernelProdContainer.php on line 459 and defined in /var/www/html/vendor/maxbanton/cwh/src/Handler/CloudWatch.php:121
!!  Stack trace:
!!  #0 /var/www/html/var/cache/prod/ContainerU7jBHOL/App_KernelProdContainer.php(459): Maxbanton\Cwh\Handler\CloudWatch->__construct(Object(Aws\CloudWatchLogs\CloudWatchLogsClient), 'debug_log', 'prod', 10000, Array, 'WARNING')
!!  #1 /var/www/html/var/cache/prod/ContainerU7jBHOL/App_KernelProdContainer.php(545): ContainerU7jBHOL\App_KernelProdContainer->getCloudwatchHandlerService()
!!  #2 /var/www/html/var/cache/prod/ContainerU7jBHOL/App_KernelProdContainer.php(558): ContainerU7jBHOL\App_KernelProdContainer->getMonolog_Handler_MainService()
!!  #3 /var/www/html/var/cache/prod/ContainerU7jBHOL/getConfigBuilder_WarmerService.php(20): ContainerU7jBHOL\App_KernelProdContainer->getMonolog_LoggerService()
!!  #4 /var/www/html/var/cache/prod/ContainerU7jBHOL/App_KernelProdContainer.php(133): ContainerU7jBHOL\getConfigBuilder_WarmerService::do(Object(ContainerU7jBHOL\App_KernelProdContainer), true)
!!  #5 /var/www/html/var/cache/prod/ContainerU7jBHOL/getCacheWarmerService.php(21): ContainerU7jBHOL\App_KernelProdContainer->load('getConfigBuilde...')
!!  #6 /var/www/html/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php(90): ContainerU7jBHOL\getCacheWarmerService::ContainerU7jBHOL\{closure}()
!!  #7 /var/www/html/vendor/symfony/http-kernel/Kernel.php(584): Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp('/var/www/html/v...')
!!  #8 /var/www/html/vendor/symfony/http-kernel/Kernel.php(786): Symfony\Component\HttpKernel\Kernel->initializeContainer()
!!  #9 /var/www/html/vendor/symfony/http-kernel/Kernel.php(125): Symfony\Component\HttpKernel\Kernel->preBoot()
!!  #10 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(168): Symfony\Component\HttpKernel\Kernel->boot()
!!  #11 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(74): Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands()
!!  #12 /var/www/html/vendor/symfony/console/Application.php(167): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!!  #13 /var/www/html/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(56): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!!  #14 /var/www/html/vendor/autoload_runtime.php(35): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run()
!!  #15 /var/www/html/bin/console(11): require_once('/var/www/html/v...')
!!  #16 {main}
!!    thrown in /var/www/html/vendor/maxbanton/cwh/src/Handler/CloudWatch.php on line 121
!!  
Script @auto-scripts was called via post-install-cmd

This only happens when APP_ENV=prod. If APP_ENV=dev then there is no problem

Unfortunately I cannot debug further by checking the code in the cache because this happens within a Bitbucket pipeline

Expected behavior
A clear and concise description of what you expected to happen.

Please provide the steps to reproduce and if possible a minimal demo of the problem
Any instructions how to reproduce a bug

Please tell about your environment:

  • PHP Version: 8
  • Operating system (distro): Ubuntu
  • Application mode:
    • Web app
    • CLI app
    • Daemon worker
@vnrld
Copy link

vnrld commented Aug 16, 2021

The constructor of the class expects these parameters

public function __construct(
        CloudWatchLogsClient $client,
        $group,
        $stream,
        $retention = 14,
        $batchSize = 10000,
        array $tags = [],
        $level = Logger::DEBUG,
        $bubble = true,
        $createGroup = true
    )

you give these

__construct(
CloudWatchLogsClient $client => Object(Aws\CloudWatchLogs\CloudWatchLogsClient), 
$group => 'debug_log',
$stream =>  'prod', 
$retention => 10000, 
$batchSize = Array, 
 array $tags = 'WARNING')

How should it work, if the expected array is a string "WARNING" ? :)

This is not a bug of the package, but from your call.

Best regards,
Lukas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants