getsentry / sentry-laravel

The official Laravel SDK for Sentry (sentry.io)
https://sentry.io
MIT License
1.25k stars 189 forks source link

Command "sentry:publish" is not defined. #531

Closed Tom-Pearce closed 2 years ago

Tom-Pearce commented 2 years ago

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

PHP: 7.1 Laravel: 5.5 sentry-laravel: ^1.9

Steps to Reproduce

  1. Ran COMPOSER_MEMORY_LIMIT=-1 composer require sentry/sentry-laravel
  2. Added captureException() snippet to Handler.php
  3. Ran php artisan sentry:publish --dsn=https://557f106825494827b3c6c48d80f901a8@o1092886.ingest.sentry.io/6134627

Expected Result

Expected config/sentry.php to be created and DSN to be added to .env file, as per documentation

Actual Result

Got the error Command "sentry:publish" is not defined.

Screenshot 2022-01-05 at 10 50 42

What I've tried so far

  1. Running php artisan config:cache
  2. Manually adding providers and aliases to config/app.php and re-running sentry:publish

sentry/sentry-laravel definitely gets discovered: Screenshot 2022-01-05 at 10 54 35

composer.json

{
  "name": "laravel/laravel",
  "description": "The Laravel Framework.",
  "keywords": ["framework", "laravel"],
  "license": "MIT",
  "type": "project",
  "repositories": [
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-contracts.git"
    },
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-documentation.git"
    },
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-reporting.git"
    },
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-targets.git"
    },
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-multisite.git"
    },
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-forms.git"
    },
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-config.git"
    },
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-ecommerce.git"
    },
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-reviews.git"
    },
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-crm.git"
    },
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-divido.git"
    },
    {
      "type": "vcs",
      "url":  "git@bitbucket.org:teamosc/osc-deko.git"
    }
  ],
  "require": {
    "php": "^7.1",
    "laravel/framework": "5.5.*",
    "barryvdh/laravel-debugbar": "2.4.*",
    "pda/pheanstalk": "~3.0@dev",
    "lord/laroute" : "^2.5",
    "laracasts/presenter": "0.2.*",
    "dansmith/laravel5-foundation": "dev-master",
    "dansmith/eloquent-filterable": "dev-master",
    "knplabs/knp-menu": "~2.0",
    "intervention/image": "~2.2",
    "intervention/imagecache": "~2.2",
    "bugsnag/bugsnag-laravel": "^2.0",
    "league/flysystem-aws-s3-v3": "~1.0",
    "omnipay/sagepay": "~2.0",
    "algolia/algoliasearch-laravel": "^1.0",
    "arcturial/clickatell": "^2.1",
    "predis/predis": "^1.0",
    "mandrill/mandrill": "^1.0",
    "phpoffice/phpexcel": "1.8.1",
    "gentle/bitbucket-api": "^0.8.1",
    "yohang/calendr": "^2.0",
    "willdurand/geocoder": "^3.3",
    "artesaos/laravel-linkedin": "^1.1",
    "facebook/graph-sdk": "^5.3",
    "gocardless/gocardless-pro": "^0.10.1",
    "erusev/parsedown-extra": "^0.7.1",
    "barryvdh/laravel-dompdf": "0.8.5",
    "baum/baum": "~1.1",
    "league/pipeline": "^0.3.0",
    "drewm/mailchimp-api": "^2.4",
    "setasign/fpdi": "^1.6",
    "setasign/fpdi-fpdf": "^1.6",
    "teamosc/osc-contracts": "dev-master",
    "teamosc/osc-documentation": "dev-master",
    "teamosc/osc-reporting": "dev-master",
    "teamosc/osc-targets": "dev-master",
    "teamosc/osc-multisite": "dev-master",
    "teamosc/osc-forms": "dev-master",
    "teamosc/osc-config": "dev-master",
    "teamosc/osc-ecommerce": "dev-master",
    "teamosc/osc-reviews": "dev-master",
    "teamosc/osc-crm": "dev-master",
    "teamosc/osc-divido": "dev-master",
    "teamosc/osc-deko": "dev-master",
    "paybreak/api-client": "^1.0",
    "erusev/parsedown": "^1.6",
    "neoxia/laravel-sftp": "^1.0",
    "laravel/tinker": "^1.0",
    "msurguy/honeypot": "dev-master",
    "torann/geoip": "^1.0",
    "payeezy/payeezy-php": "dev-master",
    "pusher/pusher-php-server": "^4.1",
    "sentry/sentry-laravel": "^1.9"
  },
  "require-dev": {
    "phpunit/phpunit": "~6.0",
    "symfony/dom-crawler": "~3.0",
    "symfony/css-selector": "~3.0",
    "mockery/mockery": "^0.9.9",
    "smalot/pdfparser": "^0.11.0",
    "codacy/coverage": "dev-master",
    "phpmd/phpmd": "^2.6",
    "xethron/migrations-generator": "^2.0",
    "fzaninotto/faker": "^1.7",
    "laravel/browser-kit-testing": "2.*",
    "laravel/dusk": "^2.0",
    "filp/whoops": "~2.0"
  },
  "extra": {
    "laravel": {
      "dont-discover": [
        "laravel/dusk",
        "gocardless/gocardless-pro"
      ]
    }
  },
  "autoload": {
    "classmap": [
      "database",
      "vendor/setasign/fpdi"
    ],
    "psr-4": {
      "App\\": "app/"
    },
    "files": ["app/Http/helpers.php"]
  },
  "autoload-dev": {
    "classmap": [
      "tests/TestCase.php"
    ],
    "psr-4": {
      "Tests\\": "tests/"
    }
  },
  "scripts": {
    "post-install-cmd": [
      "@php artisan clear-compiled",
      "@php artisan cache:clear"
    ],
    "post-update-cmd": [
      "@php artisan clear-compiled"
    ],
    "post-create-project-cmd": [
      "@php artisan key:generate"
    ],
    "post-autoload-dump": [
      "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
      "@php artisan package:discover"
    ],
    "lint": [
      "vendor/bin/phpmd . text phpmd.xml"
    ]
  },

  "config": {
    "preferred-install": "dist",
    "platform": {
      "php": "7.1"
    }
  }

}

Any suggestions would be appreciated.

Cheers, Tom

stayallive commented 2 years ago

You are using an old version of this package. Upgrading to ^2.10 should fix it šŸ‘

Tom-Pearce commented 2 years ago

Well that was an easy one, thank you very much. Not entirely sure why it would have gone for 1.9 if it's old in that case.

stayallive commented 2 years ago

Not a 100% either... although maybe because of your PHP version now I'm looking closer... v2 is 7.2+. You can still use 1.9 just fine but it requires some different setup instructions for publishing the config file (which you can also do manually).

If you can upgrade PHP I would strongly urge you to do that but I know this is not always the easy part šŸ˜…

Tom-Pearce commented 2 years ago

I got error messages for the PHP version which I updated and then all went through fine and received a test error on the dashboard. Will get some more thorough tests done to make sure the PHP version doesn't impact anything else, but all seems to be good initially for this project!

Thanks for the quick response, certainly appreciated!

stayallive commented 2 years ago

No worries, please let us know if you run into other troubles.

For now I'll close this issue since I think you got it working now :)