Hi,
After updating to 2.0.1, we get those errors :
Call to undefined method Sentry\Tracing\Transaction::setHttpStatus()' in src/Sentry/Laravel/Tracing/Middleware.php:66
Looks like the Transaction::setHttpStatus() is quite new and has been introduce in the SDK on version 3.0.2 with this PR: https://github.com/getsentry/sentry-php/pull/1092
The thing is, the composer.json file in the 2.0.1 release mention this requirement: "sentry/sdk": "^3.0".
You probably should force the version of "sentry/sdk" to at least 3.0.2 in order not to break your tracing middleware.
Looks like sentry/sdk is not even released in 3.0.2, the only stable version is 3.0.0. (cf https://packagist.org/packages/sentry/sdk).
This is a problem, I think it's not appropriate to change code to use an unstable (and not released) package where the lib bump is a patch update (sentry/sentry-laravel ^2.0.0 -> 2.0.1)
Nope yep. I've mad an error here 馃槃 It should not have added the setHttpStatus I missed that was introduced in a patch release.
Will PR the fix an will re-add it later once we tag sentry/sdk with sentry/sentry 3.1 馃憤
Ok thanks.
Actually seems like something is still not quite right... looking at the 3.0 tag the method exists just fine (Transaction extends Span): https://github.com/getsentry/sentry-php/blob/3.0.0/src/Tracing/Span.php#L241-L246.
I'll investigate... but it looks like it should work... can you share your composer.json and or see if you have some dependencies on beta versions of the Sentry SDK and/or sentry/sentry?
composer.json (only a reference to sentry-laravel):
"sentry/sentry-laravel": "^2.0",
composer.lock: (looks like we had a reference to sentry/sentry 3.0.0-beta1 indeed, not sure how this has ended up in our lock file),
{
"name": "sentry/sdk",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/getsentry/sentry-php-sdk.git",
"reference": "908ea3fd0e7a19ccf4b53d1c247c44231595d008"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-php-sdk/zipball/908ea3fd0e7a19ccf4b53d1c247c44231595d008",
"reference": "908ea3fd0e7a19ccf4b53d1c247c44231595d008",
"shasum": ""
},
"require": {
"http-interop/http-factory-guzzle": "^1.0",
"sentry/sentry": "^3.0",
"symfony/http-client": "^4.3|^5.0"
},
"type": "metapackage",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sentry",
"email": "[email protected]"
}
],
"description": "This is a metapackage shipping sentry/sentry with a recommended HTTP client.",
"homepage": "http://sentry.io",
"keywords": [
"crash-reporting",
"crash-reports",
"error-handler",
"error-monitoring",
"log",
"logging",
"sentry"
],
"funding": [
{
"url": "https://sentry.io/",
"type": "custom"
},
{
"url": "https://sentry.io/pricing/",
"type": "custom"
}
],
"time": "2020-09-28T07:49:07+00:00"
},
{
"name": "sentry/sentry",
"version": "3.0.0-beta1",
"source": {
"type": "git",
"url": "https://github.com/getsentry/sentry-php.git",
"reference": "53e8aeeef6677e23db55c63899ba01c1f4ba2265"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/53e8aeeef6677e23db55c63899ba01c1f4ba2265",
"reference": "53e8aeeef6677e23db55c63899ba01c1f4ba2265",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-mbstring": "*",
"guzzlehttp/promises": "^1.3",
"guzzlehttp/psr7": "^1.6",
"jean85/pretty-package-versions": "^1.2",
"ocramius/package-versions": "^1.8",
"php": "^7.1",
"php-http/async-client-implementation": "^1.0",
"php-http/client-common": "^1.5|^2.0",
"php-http/discovery": "^1.6.1",
"php-http/httplug": "^1.1|^2.0",
"php-http/message": "^1.5",
"psr/http-factory": "^1.0",
"psr/http-message-implementation": "^1.0",
"psr/log": "^1.0",
"symfony/options-resolver": "^2.7|^3.0|^4.0|^5.0",
"symfony/polyfill-php80": "^1.17",
"symfony/polyfill-uuid": "^1.13.1"
},
"conflict": {
"php-http/client-common": "1.8.0",
"raven/raven": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"http-interop/http-factory-guzzle": "^1.0",
"monolog/monolog": "^1.3|^2.0",
"php-http/mock-client": "^1.3",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^7.5.18",
"symfony/phpunit-bridge": "^4.3|^5.0",
"vimeo/psalm": "^3.4"
},
"suggest": {
"monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Sentry\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sentry",
"email": "[email protected]"
}
],
"description": "A PHP SDK for Sentry (http://sentry.io)",
"homepage": "http://sentry.io",
"keywords": [
"crash-reporting",
"crash-reports",
"error-handler",
"error-monitoring",
"log",
"logging",
"sentry"
],
"funding": [
{
"url": "https://sentry.io/",
"type": "custom"
},
{
"url": "https://sentry.io/pricing/",
"type": "custom"
}
],
"time": "2020-09-03T11:19:07+00:00"
},
{
"name": "sentry/sentry-laravel",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/getsentry/sentry-laravel.git",
"reference": "3c6b1da08087f428ab1a188af35483eb76ef6b1e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/3c6b1da08087f428ab1a188af35483eb76ef6b1e",
"reference": "3c6b1da08087f428ab1a188af35483eb76ef6b1e",
"shasum": ""
},
"require": {
"illuminate/support": "5.0 - 5.8 | ^6.0 | ^7.0 | ^8.0",
"php": "^7.2",
"sentry/sdk": "^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "2.16.*",
"laravel/framework": "^7.0",
"mockery/mockery": "1.3.*",
"orchestra/testbench": "^5.0",
"phpunit/phpunit": "^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev",
"dev-0.x": "0.x-dev"
},
"laravel": {
"providers": [
"Sentry\\Laravel\\ServiceProvider",
"Sentry\\Laravel\\Tracing\\ServiceProvider"
],
"aliases": {
"Sentry": "Sentry\\Laravel\\Facade"
}
}
},
"autoload": {
"psr-0": {
"Sentry\\Laravel\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Sentry",
"email": "[email protected]"
}
],
"description": "Laravel SDK for Sentry (https://sentry.io)",
"homepage": "https://sentry.io",
"keywords": [
"crash-reporting",
"crash-reports",
"error-handler",
"error-monitoring",
"laravel",
"log",
"logging",
"sentry"
],
"funding": [
{
"url": "https://sentry.io/",
"type": "custom"
},
{
"url": "https://sentry.io/pricing/",
"type": "custom"
}
],
"time": "2020-10-01T12:14:37+00:00"
},
Okay try and run a composer update sentry/sentry and or rebuild the composer.lock because you should not use any beta versions anymore, don't really understand why that wouldn't have updated but that is the cause of the error because setHttpStatus is in the 3.0 release (but not in 3.0.0-beta1).
The composer.lock should say sentry/sentry 3.0.2 by now.
Ok I'll try this in our project. Thanks @stayallive !
Everything looks good now. Thanks again!
I encounter this problem today
In my composer.lock
sentry-laravel is at 2.1.1
sentry/sentry is at 3.0.0 beta
I have tried deleting composer.lock and run composer update.
Hi @ziming, as mentioned looking at the 3.0.0 tag the method exists (Transaction extends Span): https://github.com/getsentry/sentry-php/blob/3.0.0/src/Tracing/Span.php#L241-L246.
So I appreciate you checked your versions, and that all looks good, although if you ran composer update I would expect it to be 3.0.2 by now (but that shouldn't matter anyway).
You can check the sentry-php code in your vendor directory to see if you have the correct Span.php otherwise you might want to remove your composer.lock and vendor folder and run composer install again to redownload all dependencies.
Hi @stayallive
Okay I checked my Span class in sentry/sentry does not have setHttpStatus method.
deleting my composer.lock file and run composer update does not work.
Then while trying Deleting my vendor and composer.lock file and run composer update
I saw the following:
So I did a composer clearcache
delete composer.lock and vendor folder again, then run composer update
I now see this
In my composer.json, I define laravel sentry this way
"sentry/sentry-laravel": "^2.0",
So it seem like composer keep install sentry/sentry (3.0.0-beta1) for me, even after i delete the composer.lock file and vendor folder and cleared the composer cache. I redo all the steps, switched to composer install instead of update. It still install 3.0 beta for me. I have also tried composer update sentry/sentry
Guess i will downgrade again to sentry 1.9 for now, as I'm nearing my monthly limit. Let me know when a solution is found :)
@ziming please share your full composer.json I cannot reproduce this but for some reason you are still getting 3.0.0-beta1 indeed.
Having the same error with 2.1.1
@ziming thanks for sharing (sorry I missed your comment, but you can remove it now).
I have just ran a composer install on that composer.json and I get the same result, it's installing the beta version, we are trying to figure out why it would do that but my guess is that is has something to do with "minimum-stability": "dev", although I would still expect it to install the non-beta but it doesn't. If I remove that everything installs correctly.
So for now remove "minimum-stability": "dev" from your composer.json and run composer update to get sentry/sentry versions 3.0.3 (at the time of this comment) and fix the issue.
This might also be true for you @bomshteyn, if not please share your composer.json too please.
Hi, Removing "minimum-stability": "dev" causes other issues for me.
What fixed it for me is deleting the lock file & vendor directory and adding "sentry/sentry": "^3.0.3", to composer.json
That's also a good solution, we're looking into why "minimum-stability": "dev" prefers our beta release.
@stayallive FYI, even if I closed the ticket 2 weeks ago (solving the issue by patching the composer.lock in order to fix the problem), we also had the issue again.
We also have this stability level:
"minimum-stability": "dev",
"prefer-stable": true,
I have still no clue why composer is doing this, but that's why we re-opened the issue :)
The "fix" (band-aid) by @bomshteyn seems to work good, to require "sentry/sentry": "^3.0.3" in your own composer.json seems to force it to install the correct version.
We are still looking on why this is happening but this seems like an interesting composer version resolution idiosyncrasy.
Other observations: when I downgrade to ^1.9, dependabot PR always update correctly (the non beta version)
But if i pull then composer update, it goes back to 3.0 beta again unless i remember to do composer clearcache before composer update (with the fixed lock file from dependabot).
I did not try this multiple times to see if the behaviour is consistent.
Same here. Removing "minimum-stability": "dev" and composer update sentry/sentry did the trick. But it doesn't feel good to remove minimum-stability. Any fix so far?
So because of #422 I noticed something...
Can you all make sure you have the correct PHP version constraint in your require section?
It should be at least "php": "^7.2", or higher since the 3.0 version of the PHP SDK is not compatible with PHP 7.1 and lower.
This might "help" composer figuring out the correct version to install.
@stayallive not the case here.
"php": "^7.3",
@stayallive still happens here with "php": "^7.4.7", so this seems unrelated to this directly.
That's unfortunate... thought I found it, still unable to replicate :)
So for now this is still the best "fix": https://github.com/getsentry/sentry-laravel/issues/396#issuecomment-712723804
@stayallive that "fix" does not work here, only removing "minimum-stability": "dev" results in correct resolving of sentry/sentry.
Since 2.3 we require a specific version of the PHP SDK, which should solve any issues with installing the beta version of the PHP SDK we believe.
We believe this is solved when using 2.3+ of your sentry/sentry-laravel dependency.
Feel free to re-open or create a new issue if the problem still persists 馃憤
Most helpful comment
Everything looks good now. Thanks again!