Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Error: 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. #117

Closed
dummydummydev opened this issue Dec 19, 2023 · 4 comments
Labels

Comments

@dummydummydev
Copy link

dummydummydev commented Dec 19, 2023

image (4)
image (5)
image (6)
image (7)

Issue summary

I created a app use shopify ruby template , I used the default Dockerfile give by ruby template
I created a build , but my app is not working

# Dockerfile
FROM ruby:3.1-alpine

ARG SHOPIFY_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxx
ENV SHOPIFY_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxx
RUN apk add libpq-dev
RUN apk update && apk add nodejs npm git build-base postgresql-client  gcompat bash openssl-dev
WORKDIR /app

COPY web .

RUN cd frontend && npm install
RUN bundle install

RUN cd frontend && npm run build
RUN rake build:all

COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh

ENTRYPOINT ["entrypoint.sh"]

CMD rails server -b 0.0.0.0
# docker-compose.yml
version: '3'
services:
  db:
    image: postgres
    volumes:
      - ./web/tmp/db:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: postgres    
      POSTGRES_PASSWORD: postgres
  app:
    build: .
    image: rails-web
    environment:
      SHOPIFY_API_KEY: xxxxxxxxxxxxxxxxxxxxxxxxx
      SHOPIFY_API_SECRET: xxxxxxxxxxxxxxxxxxxxxxxxxxx
      HOST: https://e70f-xxx-xxxx-553-634f-6a31-11e8-2e5d.ngrok-free.app
    stdin_open: true
    tty: true
    ports:
      - "80:3000"
    working_dir: /web
    volumes:
      - ./web:/web
    depends_on:
      - db

These are my dockerfile and docker-compose.yml file

Creating remix-shopify-rails_db_1 ... done
Creating remix-shopify-rails_app_1 ... done
Attaching to remix-shopify-rails_db_1, remix-shopify-rails_app_1
db_1   | 
db_1   | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1   | 
db_1   | 2023-12-19 06:53:47.311 UTC [1] LOG:  starting PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
db_1   | 2023-12-19 06:53:47.311 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1   | 2023-12-19 06:53:47.311 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1   | 2023-12-19 06:53:47.394 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2023-12-19 06:53:47.476 UTC [30] LOG:  database system was shut down at 2023-12-19 06:46:08 UTC
db_1   | 2023-12-19 06:53:47.502 UTC [1] LOG:  database system is ready to accept connections
db_1   | 2023-12-19 06:53:52.020 UTC [34] ERROR:  database "remix_docker_development" already exists
db_1   | 2023-12-19 06:53:52.020 UTC [34] STATEMENT:  CREATE DATABASE "remix_docker_development" ENCODING = 'unicode'
app_1  | Database 'remix_docker_development' already exists
db_1   | 2023-12-19 06:53:52.038 UTC [35] ERROR:  database "remix_docker_test" already exists
db_1   | 2023-12-19 06:53:52.038 UTC [35] STATEMENT:  CREATE DATABASE "remix_docker_test" ENCODING = 'unicode'
app_1  | Database 'remix_docker_test' already exists
app_1  | => Booting Puma
app_1  | => Rails 7.0.8 application starting in development 
app_1  | => Run `bin/rails server --help` for more startup options
app_1  | Puma starting in single mode...
app_1  | * Puma version: 5.6.7 (ruby 3.1.4-p223) ("Birdie's Version")
app_1  | *  Min threads: 5
app_1  | *  Max threads: 5
app_1  | *  Environment: development
app_1  | *          PID: 1
app_1  | * Listening on http://0.0.0.0:3000
app_1  | Use Ctrl-C to stop
app_1  | Started GET "/" for 2402:e280:230d:553:634f:6a31:11e8:2e5d at 2023-12-19 06:53:58 +0000
app_1  | Cannot render console from 2402:e280:230d:553:634f:6a31:11e8:2e5d! Allowed networks: 127.0.0.0/127.255.255.255, ::1
app_1  |   ActiveRecord::SchemaMigration Pluck (0.5ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
app_1  | Processing by HomeController#index as HTML
app_1  | Redirected to https://e70f-2402-e280-230d-553-634f-6a31-11e8-2e5d.ngrok-free.app/api/auth
app_1  | Filter chain halted as :check_shop_domain rendered or redirected
app_1  | Completed 302 Found in 4ms (ActiveRecord: 0.0ms | Allocations: 1977)
app_1  | 
app_1  | 
app_1  | Started GET "/api/auth" for 2402:e280:230d:553:634f:6a31:11e8:2e5d at 2023-12-19 06:53:58 +0000
app_1  | Cannot render console from 2402:e280:230d:553:634f:6a31:11e8:2e5d! Allowed networks: 127.0.0.0/127.255.255.255, ::1
app_1  | Processing by ShopifyApp::SessionsController#new as HTML
app_1  |   Rendering /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/sessions/new.html.erb
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/partials/_layout_styles.html.erb (Duration: 0.3ms | Allocations: 293)
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/partials/_typography_styles.html.erb (Duration: 0.3ms | Allocations: 131)
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/partials/_card_styles.html.erb (Duration: 0.2ms | Allocations: 130)
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/partials/_button_styles.html.erb (Duration: 0.3ms | Allocations: 211)
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/partials/_form_styles.html.erb (Duration: 0.3ms | Allocations: 157)
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/sessions/new.html.erb (Duration: 5.1ms | Allocations: 3111)
app_1  | Completed 200 OK in 33ms (Views: 8.5ms | ActiveRecord: 0.0ms | Allocations: 10865)
app_1  | 
app_1  | 
app_1  | Started POST "/api/auth" for 2402:e280:230d:553:634f:6a31:11e8:2e5d at 2023-12-19 06:54:01 +0000
app_1  | Cannot render console from 2402:e280:230d:553:634f:6a31:11e8:2e5d! Allowed networks: 127.0.0.0/127.255.255.255, ::1
app_1  | Processing by ShopifyApp::SessionsController#create as HTML
app_1  |   Parameters: {"authenticity_token"=>"[FILTERED]", "shop"=>"demo-store-mj.myshopify.com"}
app_1  |   Shop Load (0.3ms)  SELECT "shops".* FROM "shops" WHERE "shops"."shopify_domain" = $1 LIMIT $2  [["shopify_domain", "demo-store-mj.myshopify.com"], ["LIMIT", 1]]
app_1  |   CACHE Shop Load (0.0ms)  SELECT "shops".* FROM "shops" WHERE "shops"."shopify_domain" = $1 LIMIT $2  [["shopify_domain", "demo-store-mj.myshopify.com"], ["LIMIT", 1]]
app_1  |   CACHE Shop Load (0.0ms)  SELECT "shops".* FROM "shops" WHERE "shops"."shopify_domain" = $1 LIMIT $2  [["shopify_domain", "demo-store-mj.myshopify.com"], ["LIMIT", 1]]
app_1  | Redirected to https://demo-store-mj.myshopify.com/admin/oauth/authorize?client_id=61f6b66e9fd5f4994644fff850940c6c&scope=write_products&redirect_uri=https%3A%2F%2Fe70f-2402-e280-230d-553-634f-6a31-11e8-2e5d.ngrok-free.app%2Fapi%2Fauth%2Fcallback&state=m1LMd2UsX5zX4Sr&grant_options%5B%5D=
app_1  | Completed 302 Found in 111ms (ActiveRecord: 2.9ms | Allocations: 80987)
app_1  | 
app_1  | 
app_1  | Started GET "/api/auth/callback?code=dd8f8f60432f15bd4979f23cee8ff873&hmac=22932e69f59901c8092cbd3af9c188e62cf9fbde8891d8e9805eeae34c573b98&host=YWRtaW4uc2hvcGlmeS5jb20vc3RvcmUvZGVtby1zdG9yZS1tag&shop=demo-store-mj.myshopify.com&state=m1LMd2UsX5zX4Sr&timestamp=1702968842" for 2402:e280:230d:553:634f:6a31:11e8:2e5d at 2023-12-19 06:54:02 +0000
app_1  | Cannot render console from 2402:e280:230d:553:634f:6a31:11e8:2e5d! Allowed networks: 127.0.0.0/127.255.255.255, ::1
app_1  | Processing by ShopifyApp::CallbackController#callback as HTML
app_1  |   Parameters: {"code"=>"dd8f8f60432f15bd4979f23cee8ff873", "hmac"=>"22932e69f59901c8092cbd3af9c188e62cf9fbde8891d8e9805eeae34c573b98", "host"=>"YWRtaW4uc2hvcGlmeS5jb20vc3RvcmUvZGVtby1zdG9yZS1tag", "shop"=>"demo-store-mj.myshopify.com", "state"=>"m1LMd2UsX5zX4Sr", "timestamp"=>"1702968842"}
app_1  |   Shop Load (0.2ms)  SELECT "shops".* FROM "shops" WHERE "shops"."shopify_domain" = $1 LIMIT $2  [["shopify_domain", "demo-store-mj.myshopify.com"], ["LIMIT", 1]]
app_1  |   TRANSACTION (0.1ms)  BEGIN
app_1  |   Shop Exists? (0.4ms)  SELECT 1 AS one FROM "shops" WHERE LOWER("shops"."shopify_domain") = LOWER($1) AND "shops"."id" != $2 LIMIT $3  [["shopify_domain", "demo-store-mj.myshopify.com"], ["id", 3], ["LIMIT", 1]]
app_1  |   TRANSACTION (0.2ms)  COMMIT
app_1  | [ActiveJob] Enqueued ShopifyApp::WebhooksManagerJob (Job ID: d6b2bd93-7b4e-43ee-8058-a9682e3f1fa7) to Async(default)
app_1  | Redirected to https://admin.shopify.com/store/demo-store-mj/apps/61f6b66e9fd5f4994644fff850940c6c
app_1  | Completed 302 Found in 603ms (ActiveRecord: 1.7ms | Allocations: 14049)
app_1  | 
app_1  | 
app_1  | [ActiveJob] [ShopifyApp::WebhooksManagerJob] [d6b2bd93-7b4e-43ee-8058-a9682e3f1fa7] Performing ShopifyApp::WebhooksManagerJob (Job ID: d6b2bd93-7b4e-43ee-8058-a9682e3f1fa7) from Async(default) enqueued at 2023-12-19T06:54:03Z
app_1  | [ActiveJob] [ShopifyApp::WebhooksManagerJob] [d6b2bd93-7b4e-43ee-8058-a9682e3f1fa7] Performed ShopifyApp::WebhooksManagerJob (Job ID: d6b2bd93-7b4e-43ee-8058-a9682e3f1fa7) from Async(default) in 2486.76ms
app_1  | Started GET "/?embedded=1&hmac=5a397967d786c421d2f8e98587722105680eb0681fc08c01863de9b7282bb994&host=YWRtaW4uc2hvcGlmeS5jb20vc3RvcmUvZGVtby1zdG9yZS1tag&id_token=[FILTERED]&locale=en&prefetch=1&session=d4173f90230c87b91ee8eb38904ed8fe4c3fb3cff9e27f88a128b7326029db8f&shop=demo-store-mj.myshopify.com&timestamp=1702968846" for 2402:e280:230d:553:634f:6a31:11e8:2e5d at 2023-12-19 06:54:06 +0000
app_1  | Cannot render console from 2402:e280:230d:553:634f:6a31:11e8:2e5d! Allowed networks: 127.0.0.0/127.255.255.255, ::1
app_1  | Processing by HomeController#index as HTML
app_1  |   Parameters: {"embedded"=>"1", "hmac"=>"5a397967d786c421d2f8e98587722105680eb0681fc08c01863de9b7282bb994", "host"=>"YWRtaW4uc2hvcGlmeS5jb20vc3RvcmUvZGVtby1zdG9yZS1tag", "id_token"=>"[FILTERED]", "locale"=>"en", "prefetch"=>"1", "session"=>"d4173f90230c87b91ee8eb38904ed8fe4c3fb3cff9e27f88a128b7326029db8f", "shop"=>"demo-store-mj.myshopify.com", "timestamp"=>"1702968846"}
app_1  |   Shop Load (0.2ms)  SELECT "shops".* FROM "shops" WHERE "shops"."shopify_domain" = $1 LIMIT $2  [["shopify_domain", "demo-store-mj.myshopify.com"], ["LIMIT", 1]]
app_1  |   CACHE Shop Load (0.0ms)  SELECT "shops".* FROM "shops" WHERE "shops"."shopify_domain" = $1 LIMIT $2  [["shopify_domain", "demo-store-mj.myshopify.com"], ["LIMIT", 1]]
app_1  |   Rendering text template
app_1  |   Rendered text template (Duration: 0.0ms | Allocations: 10)
app_1  | Completed 200 OK in 5ms (Views: 1.5ms | ActiveRecord: 0.2ms | Allocations: 3654)
app_1  | 
app_1  | 
app_1  | Started GET "/index.jsx" for 2402:e280:230d:553:634f:6a31:11e8:2e5d at 2023-12-19 06:54:06 +0000
app_1  | Cannot render console from 2402:e280:230d:553:634f:6a31:11e8:2e5d! Allowed networks: 127.0.0.0/127.255.255.255, ::1
app_1  | Started GET "/dev_embed.js" for 2402:e280:230d:553:634f:6a31:11e8:2e5d at 2023-12-19 06:54:06 +0000
app_1  | Cannot render console from 2402:e280:230d:553:634f:6a31:11e8:2e5d! Allowed networks: 127.0.0.0/127.255.255.255, ::1
app_1  | Processing by HomeController#index as JS
app_1  |   Parameters: {"path"=>"dev_embed"}
app_1  | Redirected to https://e70f-2402-e280-230d-553-634f-6a31-11e8-2e5d.ngrok-free.app/api/auth
app_1  | Filter chain halted as :check_shop_domain rendered or redirected
app_1  | Completed 302 Found in 0ms (ActiveRecord: 0.0ms | Allocations: 181)
app_1  | 
app_1  | 
app_1  | Processing by HomeController#index as */*
app_1  |   Parameters: {"path"=>"index"}
app_1  | Redirected to https://e70f-2402-e280-230d-553-634f-6a31-11e8-2e5d.ngrok-free.app/api/auth
app_1  | Filter chain halted as :check_shop_domain rendered or redirected
app_1  | Completed 302 Found in 0ms (ActiveRecord: 0.0ms | Allocations: 156)
app_1  | 
app_1  | 
app_1  | Started GET "/api/auth" for 2402:e280:230d:553:634f:6a31:11e8:2e5d at 2023-12-19 06:54:06 +0000
app_1  | Cannot render console from 2402:e280:230d:553:634f:6a31:11e8:2e5d! Allowed networks: 127.0.0.0/127.255.255.255, ::1
app_1  | Processing by ShopifyApp::SessionsController#new as */*
app_1  |   Rendering /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/sessions/new.html.erb
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/partials/_layout_styles.html.erb (Duration: 0.0ms | Allocations: 9)
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/partials/_typography_styles.html.erb (Duration: 0.0ms | Allocations: 8)
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/partials/_card_styles.html.erb (Duration: 0.0ms | Allocations: 8)
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/partials/_button_styles.html.erb (Duration: 0.0ms | Allocations: 8)
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/partials/_form_styles.html.erb (Duration: 0.0ms | Allocations: 8)
app_1  |   Rendered /usr/local/bundle/gems/shopify_app-21.8.1/app/views/shopify_app/sessions/new.html.erb (Duration: 1.2ms | Allocations: 649)
app_1  | Completed 200 OK in 2ms (Views: 1.6ms | ActiveRecord: 0.0ms | Allocations: 1001)
app_1  | 

  • shopify_api version: gem "shopify_api", "~> 13.3"
  • shopify_app version: gem "shopify_app", "~> 21.7"
  • Ruby version: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
  • Operating system: Ubuntu 20.04.6 LTS (64 bits)
  • Node version : v20.9.0
  • npm version : 10.2.4
  • rails version : Rails 7.0.8

I am not able to see my UI although App is running in background

Expected behavior

I can see my UI and backend should work fine

Actual behavior

Unable to see UI

Steps to reproduce the problem

  1. Make a App with shopify ruby template
  2. use postgres as database and use the above mentioned versions
  3. make a docker-compose.yml file at root
  4. make a build and run conatiner
  5. check logs
Copy link

This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.

@github-actions github-actions bot added the Stale label Feb 18, 2024
Copy link

github-actions bot commented Mar 4, 2024

We are closing this issue because it has been inactive for a few months.
This probably means that it is not reproducible or it has been fixed in a newer version.
If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.

If you still encounter this issue with the latest version of this app template, please reopen using the issue template. You can also contribute directly by submitting a pull request.

Thank you!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2024
@siakaramalegos
Copy link

I'm having this problem too and am using the latest version of the template. Can we reopen it? Or did someone find a solution?

@siakaramalegos
Copy link

See #155 (comment) for the root cause and a workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants