Giter Site home page Giter Site logo

Comments (7)

jorrit avatar jorrit commented on June 14, 2024

I disabled the http_client integration for now to work around this problem.

from sentry-symfony.

ste93cry avatar ste93cry commented on June 14, 2024

Could you please share the Monolog configuration you're using to reproduce the issue?

from sentry-symfony.

jorrit avatar jorrit commented on June 14, 2024

packages/monolog.yaml:

monolog:
    channels:
        - app
        - import
        - translation

    handlers:
        backoffice:
            type: symfony_mailer
            from_email: '[email protected]'
            to_email:
                - '[email protected]'
            subject: '[XXXXX] %%message%%'
            level: warning
            formatter: monolog.formatter.html
            content_type: text/html
            channels:
                - ratedownload

        developers:
            type: symfony_mailer
            from_email: '[email protected]'
            to_email:
                - '[email protected]'
            subject: '[XXXXXX] %%message%%'
            level: warning
            formatter: monolog.formatter.html
            content_type: text/html
            channels:
                - app

monolog/prod/monolog.yaml:

monolog:
    handlers:
        main:
            type: fingers_crossed
            action_level: error
            handler: main_split
            excluded_http_codes: [ 404, 405 ]
            buffer_size: 50 # How many messages should be saved? Prevent memory leaks
            channels: [ "!ratedownload" ]
        main_split:
            type: group
            members: [ main_file, developers ]
        main_file:
            type: rotating_file
            path: "%kernel.logs_dir%/%kernel.environment%.log"
            level: info
            max_files: 10
        console:
            type: console
            process_psr_3_messages: false
            channels: [ "!event", "!doctrine", "!ratedownload" ]
            console_formatter_options:
                multiline: true
        #        deprecation:
        #            type: rotating_file
        #            path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"
        #            max_files: 10
        #        deprecation_filter:
        #            type: filter
        #            handler: deprecation
        #            max_level: info
        #            channels: ["php"]
        import:
            type: rotating_file
            path: "%kernel.logs_dir%/import.log"
            level: info
            channels: [ "import" ]
            max_files: 10
        translation:
            type: rotating_file
            path: "%kernel.logs_dir%/translation.log"
            level: info
            channels: [ "translation" ]
            max_files: 10
        sentry:
            type: sentry
            level: !php/const Monolog\Logger::ERROR
            hub_id: Sentry\State\HubInterface
            bubble: true
            fill_extra_context: true

from sentry-symfony.

ste93cry avatar ste93cry commented on June 14, 2024

I tried using your configuration and I cannot reproduce the issue. I didn't set the MAILER_DSN environment variable, so it's using the NullTransport of the Mailer. Likely I'm missing something, but I don't know what. Could you prepare a little repo reproducing the problem?

from sentry-symfony.

jorrit avatar jorrit commented on June 14, 2024

I tried to reproduce it in an empty project. In this project, the getMailer_TransportFactory_NullService method of the container looks like this:

    protected function getMailer_TransportFactory_NullService()
    {
        $a = ($this->privates['monolog.logger.mailer'] ?? $this->getMonolog_Logger_MailerService());

        if (isset($this->privates['mailer.transport_factory.null'])) {
            return $this->privates['mailer.transport_factory.null'];
        }
        $b = ($this->services['event_dispatcher'] ?? $this->getEventDispatcherService());

        if (isset($this->privates['mailer.transport_factory.null'])) {
            return $this->privates['mailer.transport_factory.null'];
        }
        $c = ($this->privates['.debug.http_client'] ?? $this->get_Debug_HttpClientService());

        if (isset($this->privates['mailer.transport_factory.null'])) {
            return $this->privates['mailer.transport_factory.null'];
        }

        return $this->privates['mailer.transport_factory.null'] = new \Symfony\Component\Mailer\Transport\NullTransportFactory($b, $c, $a);
    }

In the 'broken' project, it looks like this:

    /**
     * Gets the private 'mailer.transport_factory.null' shared service.
     *
     * @return \Symfony\Component\Mailer\Transport\NullTransportFactory
     */
    protected function getMailer_TransportFactory_NullService()
    {
        include_once \dirname(__DIR__, 4).''.\DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'symfony'.\DIRECTORY_SEPARATOR.'mailer'.\DIRECTORY_SEPARATOR.'Transport'.\DIRECTORY_SEPARATOR.'TransportFactoryInterface.php';
        include_once \dirname(__DIR__, 4).''.\DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'symfony'.\DIRECTORY_SEPARATOR.'mailer'.\DIRECTORY_SEPARATOR.'Transport'.\DIRECTORY_SEPARATOR.'AbstractTransportFactory.php';
        include_once \dirname(__DIR__, 4).''.\DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'symfony'.\DIRECTORY_SEPARATOR.'mailer'.\DIRECTORY_SEPARATOR.'Transport'.\DIRECTORY_SEPARATOR.'NullTransportFactory.php';

        $a = ($this->services['event_dispatcher'] ?? $this->getEventDispatcherService());

        if (isset($this->privates['mailer.transport_factory.null'])) {
            return $this->privates['mailer.transport_factory.null'];
        }

        return $this->privates['mailer.transport_factory.null'] = new \Symfony\Component\Mailer\Transport\NullTransportFactory($a, ($this->privates['.debug.http_client'] ?? $this->get_Debug_HttpClientService()), ($this->privates['monolog.logger.mailer'] ?? $this->getMonolog_Logger_MailerService()));
    }

The isset calls break the loop. I have no idea why my project doesn't have them.

The repository with the example that works is at https://github.com/jorrit/sentry-symfony-bug-demo.

from sentry-symfony.

ste93cry avatar ste93cry commented on June 14, 2024

I tried cloning your repository and running the bin/console script and it works fine, no issues during the compilation of the container. I'm sorry, I don't know how to help without a project that clearly shows the error.

from sentry-symfony.

jorrit avatar jorrit commented on June 14, 2024

I know, the repository works fine. I have yet to figure out why that repository works and my private project doesn't. It has something to do with the difference in how the DI container is generated. I'll close this issue because at this moment it doesn't seem to involve sentry directly. I will reopen when there might be something that can be improved here.

Thank you for your time.

from sentry-symfony.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.