brefphp / extra-php-extensions

Community-maintained extra PHP extensions usable in AWS Lambda with the Bref PHP runtimes.
https://bref.sh/docs/environment/php.html#extra-extensions
213 stars 110 forks source link

Call to a member function removeQueryCacheProfile() on null #440

Open pesseyjulien opened 1 year ago

pesseyjulien commented 1 year ago

Hi,

After upgrading to 1.1.1 (because now using bref v2), I'm getting the following error :

Error: Call to a member function removeQueryCacheProfile() on null
#38 /vendor/doctrine/orm/lib/Doctrine/ORM/Query.php(291): Doctrine\ORM\Query::_doExecute
#37 /vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(1212): Doctrine\ORM\AbstractQuery::executeIgnoreQueryCache
#36 /vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(1166): Doctrine\ORM\AbstractQuery::execute
#35 /vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(913): Doctrine\ORM\AbstractQuery::getArrayResult
#34 /vendor/gedmo/doctrine-extensions/src/Translatable/Mapping/Event/Adapter/ORM.php(96): Gedmo\Translatable\Mapping\Event\Adapter\ORM::loadTranslations
#33 /vendor/gedmo/doctrine-extensions/src/Translatable/TranslatableListener.php(511): Gedmo\Translatable\TranslatableListener::postLoad
#32 /vendor/symfony/doctrine-bridge/ContainerAwareEventManager.php(68): Symfony\Bridge\Doctrine\ContainerAwareEventManager::dispatchEvent
#31 /vendor/doctrine/orm/lib/Doctrine/ORM/Event/ListenersInvoker.php(98): Doctrine\ORM\Event\ListenersInvoker::invoke
#30 /vendor/doctrine/orm/lib/Doctrine/ORM/Internal/HydrationCompleteHandler.php(66): Doctrine\ORM\Internal\HydrationCompleteHandler::hydrationComplete
#29 /vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(3677): Doctrine\ORM\UnitOfWork::hydrationComplete
#28 /vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php(54): Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator::cleanup
#27 /vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php(272): Doctrine\ORM\Internal\Hydration\AbstractHydrator::hydrateAll
#26 /vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(760): Doctrine\ORM\Persisters\Entity\BasicEntityPersister::load
#25 /vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(770): Doctrine\ORM\Persisters\Entity\BasicEntityPersister::loadById
#24 /vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php(207): Doctrine\ORM\Proxy\ProxyFactory::Doctrine\ORM\Proxy\{closure}
#23 /tmp/cache/prod/doctrine/orm/Proxies/__CG__AppBundleEntitySkill.php(329): Closure::__invoke
#22 /tmp/cache/prod/doctrine/orm/Proxies/__CG__AppBundleEntitySkill.php(329): Proxies\__CG__\AppBundle\Entity\Skill::getLabel
#21 /vendor/symfony/property-access/PropertyAccessor.php(468): Symfony\Component\PropertyAccess\PropertyAccessor::readProperty
#20 /vendor/symfony/property-access/PropertyAccessor.php(154): Symfony\Component\PropertyAccess\PropertyAccessor::getValue
#19 /vendor/friendsofsymfony/elastica-bundle/src/Transformer/ModelToElasticaAutoTransformer.php(161): FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer::transformObjectToDocument
#18 /vendor/friendsofsymfony/elastica-bundle/src/Transformer/ModelToElasticaAutoTransformer.php(104): FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer::transformNested
#17 /vendor/friendsofsymfony/elastica-bundle/src/Transformer/ModelToElasticaAutoTransformer.php(170): FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer::transformObjectToDocument
#16 /vendor/friendsofsymfony/elastica-bundle/src/Transformer/ModelToElasticaAutoTransformer.php(96): FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer::transformNested
#15 /vendor/friendsofsymfony/elastica-bundle/src/Transformer/ModelToElasticaAutoTransformer.php(170): FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer::transformObjectToDocument
#14 /vendor/friendsofsymfony/elastica-bundle/src/Transformer/ModelToElasticaAutoTransformer.php(96): FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer::transformNested
#13 /vendor/friendsofsymfony/elastica-bundle/src/Transformer/ModelToElasticaAutoTransformer.php(170): FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer::transformObjectToDocument
#12 /vendor/friendsofsymfony/elastica-bundle/src/Transformer/ModelToElasticaAutoTransformer.php(79): FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer::transform
#11 /vendor/friendsofsymfony/elastica-bundle/src/Persister/ObjectPersister.php(190): FOS\ElasticaBundle\Persister\ObjectPersister::transformToElasticaDocument
#10 /vendor/friendsofsymfony/elastica-bundle/src/Persister/ObjectPersister.php(145): FOS\ElasticaBundle\Persister\ObjectPersister::replaceMany
#9 /src/Command/System/UpdateEsCommand.php(74): AppBundle\Command\System\UpdateEsCommand::execute
#8 /vendor/symfony/console/Command/Command.php(298): Symfony\Component\Console\Command\Command::run
#7 /vendor/symfony/console/Application.php(1058): Symfony\Component\Console\Application::doRunCommand
#6 /vendor/symfony/framework-bundle/Console/Application.php(96): Symfony\Bundle\FrameworkBundle\Console\Application::doRunCommand
#5 /vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application::doRun
#4 /vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Bundle\FrameworkBundle\Console\Application::doRun
#3 /vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application::run
#2 /vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(54): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner::run
#1 /vendor/autoload_runtime.php(35): require_once
#0 /bin/console(12): null

Orm config :

    orm:
        auto_generate_proxy_classes: true
        naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
        auto_mapping: true
#        metadata_cache_driver:
#            type: pool
#            pool: doctrine.system_cache_pool
        query_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
        result_cache_driver:
            type: pool
            pool: doctrine.result_cache_pool
        second_level_cache:
            enabled: '%env(bool:resolve:CACHE_ENABLED)%'
            region_cache_driver:
                type: pool
                pool: doctrine.second_level_cache_pool
framework:
    cache:
        prefix_seed: "likeo.fr"
        app: cache.adapter.redis
        default_redis_provider: snc_redis.redis_client
        pools:
            doctrine.metadata_cache_driver:
                adapter: cache.app
            doctrine.result_cache_pool:
                adapter: cache.app
            doctrine.system_cache_pool:
                adapter: cache.app
            doctrine.second_level_cache_pool:
                adapter: cache.app
            cache.api_rate_limit:
                adapter: cache.adapter.redis
                provider: snc_redis.redis_client

Any idea why ?

Thanks in advance,

pesseyjulien commented 1 year ago

If I comment the 'query_cache_driver' param -> it works.

mnapoli commented 1 year ago

Hi @pesseyjulien, any reason to think that this is related to this repository? I'm not familiar with this method, so not sure where to go from there.

pesseyjulien commented 1 year ago

Yeah, sorry I forgot to mention it works locally and on a server but does not work on my lambda :

functions:
    # This function let us run console commands in Lambda
    console:
        handler: bin/console
        role: arn:aws:iam::xxxx:role/lambda
        vpc:
            securityGroupIds:
              - sg-xx
            subnetIds:
              - subnet-xxx
              - subnet-xxx
        timeout: 900 # in seconds
        reservedConcurrency: 1 # max. processed in parallel
        memorySize: 1024
        #architecture: arm64
        layers:
            - ${bref:layer.php-82}
            - ${bref-extra:redis-php-82}
            - ${bref:layer.console}
            - 'arn:aws:lambda:eu-west-3:347599033421:layer:wkhtmltopdf-0_12_6:1'
            - 'arn:aws:lambda:eu-west-3:347599033421:layer:amazon_linux_fonts:1'

Thanks, Julien

mnapoli commented 1 year ago

Do you get any other log or warning before the error?

pesseyjulien commented 1 year ago

Nop, I have sent the full error stack trace.