Shopify / Shopify/shopify-app-template-ruby

App won't load in production: MIME type error on redirect to auth on Heroku Docker deployment

Open
#155 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
154
Forks
50
PR merge metrics
No merged PRs in 30d

Description

I'm getting a MIME type error on the auth HTML file only in production (deployed to Heroku using Docker):

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
Image

This is technically the index route that is getting redirected to auth. When holding down shift on the auth "script" file, we can see its initiator is a redirect from index.jsx:

Image

Auth response preview:
Image

It's definitely an HTML file:
Image

Headers also indicate it's HTML:
Image

But the app is expecting a JS module instead of an HTML file, and I'm not sure why - I guess because it's being redirected from index.jsx. This feels like an app config issue on auth redirects, but we didn't change any of the default configuration.

Note: app works fine in local development.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the redirect initiated by index.jsx and compare the auth asset response in local development with the Heroku Docker deployment. Inspect the production deployment configuration and response headers; done means the auth module request returns JavaScript with the correct MIME type and the app loads in production.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, javascript, ruby
Domain
authentication, devops, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.