Title: TypeError raised in the celery integration when calling a task.apply_async without arguments · Issue #2554 · getsentry/sentry-python · GitHub
Open Graph Title: TypeError raised in the celery integration when calling a task.apply_async without arguments · Issue #2554 · getsentry/sentry-python
X Title: TypeError raised in the celery integration when calling a task.apply_async without arguments · Issue #2554 · getsentry/sentry-python
Description: How do you use Sentry? Sentry Saas (sentry.io) Version 1.36.0 Steps to Reproduce Having a project with Python 3.9, Django 3.2.23, sentry_sdk>=1.36.0 and celery 5.2.6, with the sentry_sdk configured as: sentry_sdk.init( release=f"project@...
Open Graph Description: How do you use Sentry? Sentry Saas (sentry.io) Version 1.36.0 Steps to Reproduce Having a project with Python 3.9, Django 3.2.23, sentry_sdk>=1.36.0 and celery 5.2.6, with the sentry_sdk configured...
X Description: How do you use Sentry? Sentry Saas (sentry.io) Version 1.36.0 Steps to Reproduce Having a project with Python 3.9, Django 3.2.23, sentry_sdk>=1.36.0 and celery 5.2.6, with the sentry_sdk configu...
Opengraph URL: https://github.com/getsentry/sentry-python/issues/2554
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypeError raised in the celery integration when calling a task.apply_async without arguments","articleBody":"### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Version\n\n1.36.0\n\n### Steps to Reproduce\n\nHaving a project with Python 3.9, Django 3.2.23, sentry_sdk>=1.36.0 and celery 5.2.6, with the sentry_sdk configured as:\r\n\r\n```\r\nsentry_sdk.init(\r\n release=f\"project@{VERSION}\",\r\n before_send=before_send,\r\n before_breadcrumb=before_breadcrumb,\r\n environment=ENVIRONMENT,\r\n integrations=[CeleryIntegration(), DjangoIntegration(), RedisIntegration()],\r\n ignore_errors=SENTRY_IGNORE_EXCEPTIONS,\r\n send_default_pii=True,\r\n sample_rate=min(SENTRY_EVENTS_SAMPLE_RATE, 1.0),\r\n traces_sample_rate=min(SENTRY_TRACES_SAMPLE_RATE, 1.0),\r\n )\r\n```\r\nwhen calling a task directly (not scheduled with celery beat) with the `.apply_async()` method without params, the sentry_sdk raises a `TypeError` exception in https://github.com/getsentry/sentry-python/pull/2510/files#diff-bbcc458d29b0f1880cf429abbf8a94a5e8517f61072945d783e44fec4969a10bR169 e.g.:\r\n\r\n```\r\nTraceback (most recent call last):\r\nFile \"/virtualenv/lib/python3.9/site-packages/celery/app/trace.py\", line 451, in trace_task\r\nR = retval = fun(*args, **kwargs)\r\nFile \"/virtualenv/lib/python3.9/site-packages/sentry_sdk/integrations/celery.py\", line 306, in _inner\r\nreraise(*exc_info)\r\nFile \"/virtualenv/lib/python3.9/site-packages/sentry_sdk/_compat.py\", line 115, in reraise\r\nraise value\r\nFile \"/virtualenv/lib/python3.9/site-packages/sentry_sdk/integrations/celery.py\", line 301, in _inner\r\nreturn f(*args, **kwargs)\r\nFile \"/virtualenv/lib/python3.9/site-packages/celery/app/trace.py\", line 734, in __protected_call__\r\nreturn self.run(*args, **kwargs)\r\nFile \"/app/src/virus_scanner/tasks.py\", line 79, in load_from_queue\r\nload_from_queue.apply_async()\r\nFile \"/virtualenv/lib/python3.9/site-packages/celery_common/tasks.py\", line 57, in apply_async\r\nreturn super().apply_async(args, kwargs, **options)\r\nFile \"/virtualenv/lib/python3.9/site-packages/sentry_sdk/integrations/celery.py\", line 169, in apply_async\r\ntask_started_from_beat = args[1][0] == \"BEAT\"\r\nTypeError: 'NoneType' object is not subscriptable\r\n```\r\n\r\n\n\n### Expected Result\n\nthe task is executed properly \n\n### Actual Result\n\na 500 error is raised","author":{"url":"https://github.com/avallbona","@type":"Person","name":"avallbona"},"datePublished":"2023-12-01T10:00:23Z","url":"https://github.com/getsentry/sentry-python/issues/2554"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fd73e8f6-063e-a079-b371-b8d0b1b48eda |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA44:235389:48C2DC:61E574:6B008E14 |
| html-safe-nonce | f24593d3208864960e929b0f3436173799518b92a4f331c4073a4b2d7c45a60a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTQ0OjIzNTM4OTo0OEMyREM6NjFFNTc0OjZCMDA4RTE0IiwidmlzaXRvcl9pZCI6IjU5Mzc5OTczOTg5NzMzODYyNjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 31f22b84c41c00ff8da671c3709ee27a71463ac2a699da3ea0f68b6cb3908313 |
| hovercard-subject-tag | issue:2020527958 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-python/2554/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4517765e914c8bc50a4e3953ace970a8ac3fdeeee1ea4d21313be889bc01b892/getsentry/sentry-python/issues/2554 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4517765e914c8bc50a4e3953ace970a8ac3fdeeee1ea4d21313be889bc01b892/getsentry/sentry-python/issues/2554 |
| og:image:alt | How do you use Sentry? Sentry Saas (sentry.io) Version 1.36.0 Steps to Reproduce Having a project with Python 3.9, Django 3.2.23, sentry_sdk>=1.36.0 and celery 5.2.6, with the sentry_sdk configured... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | avallbona |
| hostname | github.com |
| expected-hostname | github.com |
| None | c710a5cb5c47be60abfe6e8410436d409906979dbed614ef09f29c60f5535b08 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 137814779 |
| octolytics-dimension-repository_nwo | getsentry/sentry-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 137814779 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | be616a2a6ec1c609d6e002896dff5352d5c5f28b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width