FriendsOfShopware / shopware-sentry-bundle

10 stars 4 forks source link

There is no extension able to load the configuration for "sentry" #5

Closed pboese closed 5 months ago

pboese commented 6 months ago

Question

Heya,

I installed the bundle via Composer and created the configuration file with our DSN. Now when I visit our Shop, I get the following error:

There is no extension able to load the configuration for "sentry" (in "/home/forge/shopware/config/packages/sentry.yaml"). Looked for namespace "sentry", found ""framework", "twig", "monolog", "shopware", "elasticsearch", "storefront"" in /home/forge/shopware/config/packages/sentry.yaml (which is loaded in resource "/home/forge/shopware/config/packages/sentry.yaml").

Any help would be much appreciated :-)

schiefertom commented 6 months ago

I had the same error and could resolve it by installing sentry with composer manually.

Just run: composer require sentry/sentry-symfony

The reason is, that in the sentry-bundle composer.json it is required. Why it does not get installed automatically, I do not know. "name": "frosh/sentry-bundle", "type": "library", "description": "Integrates the Sentry SDK into Shopware", "keywords": ["shopware", "sentry", "error", "monitoring"], "homepage": "https://friendsofshopware.com", "license": "MIT", "require": { "sentry/sentry-symfony": "^4.0" }, "autoload": { "psr-4": { "Frosh\\SentryBundle\\": "src/" } } }

shyim commented 5 months ago

AHHH maybe it‘s a transitive dependency, and it needs to be really required

pboese commented 5 months ago

@schiefertom @shyim thanks for your help, sadly I still can't get it to work

My composer.json looks like this:

    "require": {
        "composer-runtime-api": "^2.0",
        "frosh/sentry-bundle": "*",
        "sentry/sentry-symfony": "*",
        "shopware/administration": "6.5.8.7",
        "shopware/core": "6.5.8.7",
        "shopware/elasticsearch": "6.5.8.7",
        "shopware/storefront": "6.5.8.7",
        "symfony/flex": "~2",
        "symfony/runtime": ">=5"
    },

When running e.g. php bin/console cache:clear or opening the shop's URL I get the same error as before

php bin/console cache:clear
Symfony\Component\Config\Exception\LoaderLoadException^ {#5877
  #message: "There is no extension able to load the configuration for "sentry" (in "/Users/pelle/Sites/shopware.marks/config/packages/sentry.yaml"). Looked for namespace "sentry", found ""framework", "twig", "monolog", "shopware", "elasticsearch", "storefront"" in /Users/pelle/Sites/shopware.marks/config/packages/sentry.yaml (which is loaded in resource "/Users/pelle/Sites/shopware.marks/config/packages/sentry.yaml")."
  #code: 0
  #file: "./vendor/symfony/config/Loader/FileLoader.php"
  #line: 182
  -previous: Symfony\Component\DependencyInjection\Exception\InvalidArgumentException^ {#5872
    #message: "There is no extension able to load the configuration for "sentry" (in "/Users/pelle/Sites/shopware.marks/config/packages/sentry.yaml"). Looked for namespace "sentry", found ""framework", "twig", "monolog", "shopware", "elasticsearch", "storefront""."
    #code: 0
    #file: "./vendor/symfony/dependency-injection/Loader/YamlFileLoader.php"
    #line: 808
    trace: {
      ./vendor/symfony/dependency-injection/Loader/YamlFileLoader.php:808 { …}
      ./vendor/symfony/dependency-injection/Loader/YamlFileLoader.php:783 { …}
      ./vendor/symfony/dependency-injection/Loader/YamlFileLoader.php:124 { …}
      ./vendor/symfony/config/Loader/FileLoader.php:167 { …}
      ./vendor/symfony/config/Loader/FileLoader.php:98 { …}
      ./vendor/symfony/dependency-injection/Loader/FileLoader.php:70 { …}
      ./vendor/symfony/dependency-injection/Loader/GlobFileLoader.php:24 { …}
      ./vendor/symfony/config/Loader/DelegatingLoader.php:37 { …}
      ./vendor/shopware/core/Kernel.php:283 { …}
      ./vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:175 { …}
      ./vendor/symfony/dependency-injection/Loader/ClosureLoader.php:36 { …}
      ./vendor/symfony/config/Loader/DelegatingLoader.php:37 { …}
      ./vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:146 { …}
      ./vendor/symfony/http-kernel/Kernel.php:608 { …}
      ./vendor/symfony/http-kernel/Kernel.php:505 { …}
      ./vendor/shopware/core/Kernel.php:192 { …}
      ./bin/console:51 {
        {closure}^
        › $application = new Application($kernel->getKernel());
        › $kernel->getKernel()->boot();
        ›
      }
      ./vendor/symfony/runtime/Resolver/DebugClosureResolver.php:25 { …}
      ./vendor/autoload_runtime.php:24 { …}
      ./bin/console:15 { …}
    }
  }
  trace: {
    ./vendor/symfony/config/Loader/FileLoader.php:182 { …}
    ./vendor/symfony/config/Loader/FileLoader.php:98 { …}
    ./vendor/symfony/dependency-injection/Loader/FileLoader.php:70 { …}
    ./vendor/symfony/dependency-injection/Loader/GlobFileLoader.php:24 { …}
    ./vendor/symfony/config/Loader/DelegatingLoader.php:37 { …}
    ./vendor/shopware/core/Kernel.php:283 { …}
    ./vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:175 { …}
    ./vendor/symfony/dependency-injection/Loader/ClosureLoader.php:36 { …}
    ./vendor/symfony/config/Loader/DelegatingLoader.php:37 { …}
    ./vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:146 { …}
    ./vendor/symfony/http-kernel/Kernel.php:608 { …}
    ./vendor/symfony/http-kernel/Kernel.php:505 { …}
    ./vendor/shopware/core/Kernel.php:192 { …}
    ./bin/console:51 {
      {closure}^
      › $application = new Application($kernel->getKernel());
      › $kernel->getKernel()->boot();
      ›
    }
    ./vendor/symfony/runtime/Resolver/DebugClosureResolver.php:25 { …}
    ./vendor/autoload_runtime.php:24 { …}
    ./bin/console:15 { …}
  }
}
2024-03-21T15:04:44+00:00 [critical] Uncaught Exception: There is no extension able to load the configuration for "sentry" (in "/Users/pelle/Sites/shopware.marks/config/packages/sentry.yaml"). Looked for namespace "sentry", found ""framework", "twig", "monolog", "shopware", "elasticsearch", "storefront"" in /Users/pelle/Sites/shopware.marks/config/packages/sentry.yaml (which is loaded in resource "/Users/pelle/Sites/shopware.marks/config/packages/sentry.yaml").
shyim commented 5 months ago

is the bundle inside config/bundles.php?

pboese commented 5 months ago

is the bundle inside config/bundles.php?

@shyim yes, it's there, I changed from prod to all - still no success

Sentry\SentryBundle\SentryBundle::class => ['all' => true],
pboese commented 5 months ago

@shyim is there any way to reopen this ticket? I still can't get it to work :-(

m-overlund commented 5 months ago

what does your packages/sentry.yaml look like? (without DSN keys)

pboese commented 5 months ago

@m-overlund like this:

parameters:
    env(SENTRY_DSN): 'https://XXX@XXX.ingest.us.sentry.io/XXX'
    env(SENTRY_RELEASE): '1'

# Tells Shopware to forward traces to Sentry
shopware:
    profiler:
        integrations:
            - Sentry

sentry:
    dsn: "%env(SENTRY_DSN)%"
    tracing:
        enabled: true
        dbal:
            enabled: false
        cache:
            enabled: false
        twig:
            enabled: false
        http_client:
            enabled: true
    messenger:
        enabled: true
    options:
        integrations:
          # Use default exception ignore list of Shopware
          - 'Frosh\SentryBundle\Integration\UseShopwareExceptionIgnores'
        environment: '%kernel.environment%'
        release: '%env(SENTRY_RELEASE)%'
        # Trace 10% of requests
        traces_sample_rate: 0.1

# Optional: Report scheduled tasks status to Sentry. See https://docs.sentry.io/product/crons/ for more information and check pricing before enabling this feature.
frosh_sentry:
    report_scheduled_tasks: false
pboese commented 5 months ago

I'm now getting a different error message @m-overlund @shyim

Symfony\Component\Config\Exception\LoaderLoadException^ {#5888
  #message: "There is no extension able to load the configuration for "frosh_sentry" (in "/Users/pelle/Sites/shopware.marks/config/packages/sentry.yaml"). Looked for namespace "frosh_sentry", found ""framework", "twig", "monolog", "shopware", "elasticsearch", "storefront", "sentry"" in /Users/pelle/Sites/shopware.marks/config/packages/sentry.yaml (which is loaded in resource "/Users/pelle/Sites/shopware.marks/config/packages/sentry.yaml")."
pboese commented 5 months ago

After adding the following line to bundles.php it's finally working :-) Cheerio

Frosh\SentryBundle\ShopwareSentryBundle::class => ['all' => true],