Developing on the mobile version of Discourse

I’ve got a local development installation of Discourse running on my Ubuntu machine. I’ve got the main development version up and running just fine by following the local install guide. Given the new addition of ember-cli, I’ve got that running, too, proxying to the Rails app. I’m able to fully interact with the desktop version of the app.

However, when I use Chrome’s DevTools to view the mobile version, things aren’t working. I simply get a blank page with a “200 OK” response, but absolutely no content. It’s just entirely blank.

I can see via the Rails logs that it is rendering something, but it doesn’t seem to get proxied through Ember.

Started GET "/" for <redacted> at 2022-01-31 22:51:03 +0000
   Rendering layout layouts/application.html.erb
   Rendering categories/index.html.erb within layouts/application
   Rendered categories/index.html.erb within layouts/application (Duration: 2.8ms | Allocations: 925)
   Rendered layouts/_head.html.erb (Duration: 1.6ms | Allocations: 273)
   Rendered common/_discourse_stylesheet.html.erb (Duration: 3.2ms | Allocations: 609)
   Rendered layouts/_head_tag.html.erb (Duration: 0.2ms | Allocations: 65)
   Rendered application/_header.html.erb (Duration: 2.5ms | Allocations: 824)
   Rendered layouts/_body_tag.html.erb (Duration: 0.1ms | Allocations: 21)
   Rendered layout layouts/application.html.erb (Duration: 22.6ms | Allocations: 4961)

ember-cli isn’t logging anything about the request.

Presumably I’ve misconfigured something and it’s throwing an error somewhere, but I just can’t seem to figure out where or how to get the error the show. Are there any additional flags or environment variables I can set to get more verbose logging around this issue? I have tried setting DEBUG=ember-cli:* as suggested here but this didn’t log anything about the request.

Any help around this issue would be greatly appreciated! Long time user of Discourse, thanks for developing it!

2 Likes

Any javascript errors in the browser console?

1 Like

Sadly no. The only thing showing in the console is this (in red):

GET http://localhost:4200/ 200 (OK)

The response is, strangely, entirely empty.

Any ideas on how to enable more verbose logging for either Ember CLI or Discourse itself? If I could just see what the error is, I can probably resolve whatever the issue is. I just can’t see any errors whatsoever for some reason. Any ideas?

After doing some digging through the source, I found two environment variables that help:

  • PRINT_EXCEPTIONS - shows all exceptions, maybe too noisy to be valuable but it helped
  • RAILS_LOGS_STDOUT - logs everything to console which is what I was looking for above

These helped confirm that there wasn’t an error occurring within Rails nor my theme’s SCSS.

Apparently there was some gzip component stuck between ember and Rails. I’m not sure how this got there, but when the headers Content-Encoding exists, this particular line was copying that over and causing the browser (and curl) to just ignore the entire response body (presumably because it was no longer encoded in gzip).

It looks like this has been fixed in 2.9.0.beta1 but I am running 2.7.13.

Removing the gzip component in development fixed the issue for my particular version, but it looks like it’ll work fine with gzip in the future. Not sure why the desktop version didn’t exhibit the same issue.

Hopefully this helps anyone else facing similar issues.

3 Likes