posthog icon indicating copy to clipboard operation
posthog copied to clipboard

500 error returned from <domain>/complete/saml/ during SSO setup to self-hosted instance.

Open mengxuzhao opened this issue 3 years ago • 1 comments

Bug description

  • A 500 server error was returned from <domain>/complete/saml/ during SSO setup.
  • Found error matching up with the SAML configuration from posthog-web pod: {"event": "Internal Server Error: /complete/saml/", "timestamp": "2022-10-13T04:44:36.939135Z", "logger": "django.request", "level": "error", "pid": 20, "tid": 140409047923504, "exception": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.8/site-packages/django/utils/datastructures.py\", line 76, in __getitem__\n list_ = super().__getitem__(key)\nKeyError: 'RelayState'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py\", line 47, in inner\n response = get_response(request)\n File \"/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py\", line 181, in _get_response\n response = wrapped_callback(request, *callback_args, **callback_kwargs)\n File \"/usr/local/lib/python3.8/site-packages/django/views/decorators/cache.py\", line 44, in _wrapped_view_func\n response = view_func(request, *args, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/django/views/decorators/csrf.py\", line 54, in wrapped_view\n return view_func(*args, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/social_django/utils.py\", line 46, in wrapper\n return func(request, backend, *args, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/social_django/views.py\", line 31, in complete\n return do_complete(request.backend, _do_login, user=request.user,\n File \"/usr/local/lib/python3.8/site-packages/social_core/actions.py\", line 45, in do_complete\n user = backend.complete(user=user, *args, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/social_core/backends/base.py\", line 40, in complete\n return self.auth_complete(*args, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/social_core/backends/saml.py\", line 313, in auth_complete\n idp_name = self.strategy.request_data()['RelayState']\n File \"/usr/local/lib/python3.8/site-packages/django/utils/datastructures.py\", line 78, in __getitem__\n raise MultiValueDictKeyError(key)\ndjango.utils.datastructures.MultiValueDictKeyError: 'RelayState'"} *Screenshot of the error:
    MicrosoftTeams-image

How to reproduce

  1. Filled in SAML configuration details with SAML metadata.
  2. Add auth domain with SAML details.
  3. /complete/saml/ returned 500 server error.

Environment

  • [ ] PostHog Cloud
  • [x] self-hosted PostHog, version: 1.40.0 + Enterprise plan

Additional context

According to https://posthog.com/manual/sso, no auth domain verification is needed for self-hosted instance, and we also left RelayState empty as the field is optional.

Thank you for your bug report – we love squashing them!

mengxuzhao avatar Oct 13 '22 08:10 mengxuzhao

This issue hasn't seen activity in two years! If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in two weeks.

posthog-bot avatar Oct 18 '24 07:10 posthog-bot

This issue was closed due to lack of activity. Feel free to reopen if it's still relevant.

posthog-bot avatar Nov 01 '24 07:11 posthog-bot