# Rails error when using DiscourseConnect and Wordpress

**URL:** https://meta.discourse.org/t/rails-error-when-using-discourseconnect-and-wordpress/237133
**Category:** Support
**Created:** [August 24, 2022, 9:17pm UTC](https://meta.discourse.org/t/rails-error-when-using-discourseconnect-and-wordpress/237133 "2022-08-24T21:17:01Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Shubh\_Bhalla](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shubh_bhalla/32/271799_2.png) [@Shubh\_Bhalla](https://meta.discourse.org/u/Shubh_Bhalla)
#### Post date: [August 24, 2022, 9:17pm UTC](https://meta.discourse.org/t/rails-error-when-using-discourseconnect-and-wordpress/237133/1 "2022-08-24T21:17:01Z")

</div>

Hey Angus, I am having the same error as OP and I have attached my logs. Can you please have a look?

 ![Screen Shot 2022-08-24 at 2.16.29 PM](https://global.discourse-cdn.com/meta/original/4X/b/9/7/b9767ea5ba9d0d9dee1d231ea8286b482b688d45.png)

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [August 25, 2022, 6:57am UTC](https://meta.discourse.org/t/rails-error-when-using-discourseconnect-and-wordpress/237133/2 "2022-08-25T06:57:59Z")

</div>

Welcome @Shubh_Bhalla 🙂

I’ve moved your post to a new topic as it’s not clear to me if there’s any connection with the [topic you posted in](https://meta.discourse.org/t/sso-redirect-issues/216011/9).

Could you just confirm a few things for me:

1. Your issue presents as a redirect loop when attempting to use [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) with Discourse and Wordpress via the [WP Discourse](https://github.com/discourse/wp-discourse) plugin. Is that right? If it is, is [WP Discourse](https://github.com/discourse/wp-discourse) the [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) provider?
2. The log you’ve posted seems to be a backtrace from an exception in Discourse. Could you share the exception itself, i.e. not just the backtrace.
3. Assuming 1 is true, what logs do have in [WP Discourse](https://github.com/discourse/wp-discourse)? Please see [WP Discourse logs](https://meta.discourse.org/t/wp-discourse-logging/190745) on how to access them.

---

<div class="post-metadata">

### Author: ![Shubh\_Bhalla](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shubh_bhalla/32/271799_2.png) [@Shubh\_Bhalla](https://meta.discourse.org/u/Shubh_Bhalla)
#### Post date: [August 25, 2022, 4:55pm UTC](https://meta.discourse.org/t/rails-error-when-using-discourseconnect-and-wordpress/237133/3 "2022-08-25T16:55:14Z")

</div>

> [@angus](#):
>
> suming 1 is true, what logs do have in [WP Discourse](https://github.com/discourse/wp-discourse)? Please see

Hey @angus . So, my discourse is hosted on an EC2 instance by following through [this tutorial](https://www.axelfernandes.com/how-to-configure-discourse-on-amazon-web-services-aws). What happens is when I try to access discourse.mydomain, i get redirect to discourse.mydomain/session/sso and then redirect to [https://mydomain/#/discourse/sso?sso=bm9uY2U9MTZlNjVmxNGY2M....mcmV0dXJuX3Nzb191cmw9aHR0cHMlM0ElMkYlMkZkaXNjb3Vyc2UuYmlvLWNvbnZlcnNpb24ub3JnJTJGc2Vzc2lvbiUyRnNzb19sb2dpbg%3D%3D&sig=285c1ccdd0a9e18888....c5d32291880c759b](https://mydomain/#/discourse/sso?sso=bm9uY2U9MTZlNjVmxNGY2M....mcmV0dXJuX3Nzb191cmw9aHR0cHMlM0ElMkYlMkZkaXNjb3Vyc2UuYmlvLWNvbnZlcnNpb24ub3JnJTJGc2Vzc2lvbiUyRnNzb19sb2dpbg%3D%3D&sig=285c1ccdd0a9e18888....c5d32291880c759b) which leads to mydomain  
The error that it is giving me is -  
 ![Screen Shot 2022-08-25 at 9.53.09 AM](https://global.discourse-cdn.com/meta/original/4X/8/c/d/8cdc0e4955f3e7b50033803997001b96a1af8e76.png)

---

<div class="post-metadata">

### Author: ![Shubh\_Bhalla](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shubh_bhalla/32/271799_2.png) [@Shubh\_Bhalla](https://meta.discourse.org/u/Shubh_Bhalla)
#### Post date: [August 25, 2022, 4:59pm UTC](https://meta.discourse.org/t/rails-error-when-using-discourseconnect-and-wordpress/237133/4 "2022-08-25T16:59:54Z")

</div>

Also it is super weird that this only happens when i clear cookies from discourse.mydomain . But this problem fixes itself when i try to login through [https://discourse.mydomain/u/admin-login](https://discourse.mydomain/u/admin-login) but comes again if we clear cookies for discourse

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [August 29, 2022, 9:19am UTC](https://meta.discourse.org/t/rails-error-when-using-discourseconnect-and-wordpress/237133/5 "2022-08-29T09:19:27Z")

</div>

Your issue is most likely a misconfiguration of [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true). Please start from the beginning again and make sure you follow this guide closely. The details you’ve given a bit vague to give you more specific advice than that at this stage.

> [@Configure single sign-on (SSO) with WP Discourse and DiscourseConnect](https://meta.discourse.org/t/wp-discourse-and-discourseconnect/223494):
>
> The [WP Discourse](https://github.com/discourse/wp-discourse) plugin lets you set up [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) in Wordpress so your users can use their Wordpress account to log into Discourse, or their Discourse account to log into Wordpress. Before you can set up [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) you first have to install the [WP Discourse](https://github.com/discourse/wp-discourse) plugin on Wordpress and Connect it to your Discourse. If you’re ready to get started, start by watching this short video, or follow the instructions below. Next Step Once you’ve set up [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true), you may want to check o…

If you’re still having issues after following that guide closely please ask a question in that topic.

> [@Shubh\_Bhalla](#):
>
> Also it is super weird that this only happens when i clear cookies from discourse.mydomain . But this problem fixes itself when i try to login through [https://discourse.mydomain/u/admin-login](https://discourse.mydomain/u/admin-login) but comes again if we clear cookies for discourse

This is happening because by clearing your cookies you are effectively logging yourself out.
