Giter Club home page Giter Club logo

Comments (8)

roelvanhintum avatar roelvanhintum commented on July 17, 2024

@martinhellwagner currently (2.0.1) the plugin uses App::env, which should automatically solve this.
see: https://github.com/craftcms/cms/blob/main/src/helpers/App.php#L91

Additionally: Craft 4 has deprecated the ENVIRONMENT env in favor of CRAFT_ENVIRONMENT.

from craft-sentry.

martinhellwagner avatar martinhellwagner commented on July 17, 2024

@roelvanhintum

Thanks for the clarification! Is it possible to use version 2.x of the plugin with Craft 3 as well? We haven't yet upgraded the project to Craft 4.

from craft-sentry.

roelvanhintum avatar roelvanhintum commented on July 17, 2024

@martinhellwagner not sure, but i think not. The upside is that the craft 3 version of the plugin does lean on the ‘CRAFT_ENVIRONMENT’ variable.

from craft-sentry.

martinhellwagner avatar martinhellwagner commented on July 17, 2024

@roelvanhintum

Is there any way to make the 1.x version of the plugin work when the CRAFT_ENVIRONMENT variable is not correctly consumed?

from craft-sentry.

roelvanhintum avatar roelvanhintum commented on July 17, 2024

@martinhellwagner not sure what you mean, isn’t this working? It should be just using the var as usual in craft 3.
https://github.com/born05/craft-sentry/blob/master/src/Plugin.php#L64

from craft-sentry.

martinhellwagner avatar martinhellwagner commented on July 17, 2024

@roelvanhintum

We're setting the variable like this in our web/index.php file:

define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');

But in line 64 of the Plugin.php file, this variable isn't available and can't be consumed, resulting in a failure of our pipeline (or every time a Sentry error should be reported).

from craft-sentry.

roelvanhintum avatar roelvanhintum commented on July 17, 2024

Just to be sure, is the variable set before bootstrapping craft? And is it also set in the ‘craft’ file? Later versions of craft 3 suggest using a bootstrap.php, to make sure they are the same in both files.

from craft-sentry.

martinhellwagner avatar martinhellwagner commented on July 17, 2024

@roelvanhintum

Acutally, it was not set in the craft file. That seems to have been the issue. Thanks a lot for pointing that out! 👍🏼

from craft-sentry.

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.