Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails web app: Rack app error handling request { GET /packs/js/application-682c14949987e19a8380.js }

When I load the home view (or any view) on my local version of a Rails 6 app, which I'm running with webpack-dev-server through localhost, the page will load, but but not the javascript as I continue to get the following internal server error when webpack calls for application.js in my app/javascript/packs directory:

    2020-07-28 18:04:57 -0500: HTTP parse error, malformed request ():
    #<Puma::HttpParserError: Invalid HTTP format, parsing fails.
    
    --- 
    2020-07-28 18:04:57 -0500: Rack app error handling request { GET /packs/js/application-682c14949987e19a8380.js }
    
    #<OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: wrong version number>

followed by some more extraneous/vague information. When I run bin/webpack-dev-server, everything (I'm assuming) goes smoothly as so:

ℹ 「wds」: Project is running at https://localhost:3000/

ℹ 「wds」: webpack output is served from /packs/

ℹ 「wds」: Content not from webpack is served from /home/gabe/domus/public/packs

ℹ 「wds」: 404s will fallback to /index.html

ℹ 「wdm」: Hash: 6c3a88060d923134f5c3

Version: webpack 4.44.0

Time: 1399ms

Built at: 07/28/2020 5:51:22 PM

                                    Asset       Size       Chunks                         Chunk Names

   js/application-682c14949987e19a8380.js    508 KiB  application  [emitted] [immutable]  application

js/application-682c14949987e19a8380.js.map    572 KiB  application  [emitted] [dev]        application

                            manifest.json  364 bytes               [emitted]

ℹ 「wdm」: Compiled successfully.

In my application.html.slim file I call the application.js file with javascript_pack_tag:

html
  head
    title Domus
    = csrf_meta_tags
    = csp_meta_tag

    = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
    = javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'

  body
    = yield

And my webpacker.yml file looks like so:

default: &default
  source_path: app/javascript
  source_entry_path: packs
  public_root_path: public
  public_output_path: packs
  cache_path: tmp/cache/webpacker
  check_yarn_integrity: false
  webpack_compile_output: true

  resolved_paths: []

  cache_manifest: false

  extract_css: false

  static_assets_extensions:
    - .jpg
    - .jpeg
    - .png
    - .gif
    - .tiff
    - .ico
    - .svg
    - .eot
    - .otf
    - .ttf
    - .woff
    - .woff2

  extensions:
    - .mjs
    - .js
    - .sass
    - .scss
    - .css
    - .module.sass
    - .module.scss
    - .module.css
    - .png
    - .svg
    - .gif
    - .jpeg
    - .jpg

development:
  <<: *default
  compile: true

  check_yarn_integrity: true

  dev_server:
    https: true
    host: localhost
    port: 3000
    public: localhost:3000
    hmr: false
    inline: false
    overlay: true
    compress: true
    disable_host_check: true
    use_local_ip: false
    quiet: false
    pretty: false
    headers:
      'Access-Control-Allow-Origin': '*'
    watch_options:
      ignored: '**/node_modules/**'

I'm not too sure what else to try. Any help would be appreciated!

like image 464
gdotmount Avatar asked Oct 27 '25 06:10

gdotmount


1 Answers

I fixed this by running bin/webpack-dev-server first and then rails s

like image 115
mvassaramo Avatar answered Oct 28 '25 19:10

mvassaramo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!