When an existing Drupal user tries to access the discourse site which is connected with SSO, and a discourse login is not yet created for that user, he is redirected to drupal which shows an unexpected error:
The website encountered an unexpected error. Please try again later.
Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'canonical' found for the 'file' entity type in Drupal\Core\Entity\EntityBase->toUrl() (line 196 of core/lib/Drupal/Core/Entity/EntityBase.php).
Drupal\discourse_sso\Controller\DiscourseSsoController->validate() (Line: 85)
Drupal\discourse_sso\Controller\DiscourseSsoController->discourse_sso()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 705)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comments
Comment #2
jurgenhaasAre you really testing with the rc5 release? You should rather test with the latest dev to make sure the issue hasn't already been fixed by another issue.
The, the reported problem is around this code in line 115 of DiscourseSsoController.php:
Looks like the file entity doesn't have a canonical url anymore and we need another way to determine the url which will be passed over to Discourse for the user image.
As I'M not running a Discourse instance myself anymore, this needs to be worked on by someone who does and I'm happy to review patches which are going to resolve the issue.
Comment #3
Yuri commented@jurgenhaas you are right, the error only appears if drupal user account has a profile image. When I remove the profile image from the drupal account, discourse gives the page which says the account is pending approval.
Thats at least a bit of good progress, thanks!
Comment #4
jurgenhaasThe pending approval is certainly related to #3172534: Login error when SSO is activated
The user image issue needs local debug and a patch, can you provide something for this?
Comment #5
daggerhart commentedAttached patch should resolve the issue.
Comment #6
daggerhart commentedComment #7
shenron_segamag commentedHi,
The patch works fine for me.
Thanks !
Comment #9
jurgenhaasThanks everybody, committed the patch to the dev branch.