react-rails icon indicating copy to clipboard operation
react-rails copied to clipboard

SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)

Open majksner opened this issue 6 years ago • 1 comments

Steps to reproduce

  1. add {prerender: true} to react_component

Expected behavior

Component to be server side rendered

Actual behavior

SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate) at runtime

System configuration

Webpacker version: 4.0.7 React-Rails version: 2.5.0 React_UJS version: 2.5.0 Rails version: 5.2.3 Ruby version: 2.6.3


When adding {prerender: true} to react_component component tag, server throws error at runtime. I'm using https://github.com/puma/puma-dev with .test domain and puma-dev has it's own self-signed certificate that was added to keychain and trust.

majksner avatar Jul 23 '19 07:07 majksner

I temporarily solved locally by changing this line:

https://github.com/reactjs/react-rails/blob/344ba138a5c827a4d9e55787b5afc0f477a609f1/lib/react/server_rendering/webpacker_manifest_container.rb#L47

to:

            dev_server_asset = open(
              "#{ds.protocol}://#{ds.host_with_port}#{asset_path}",
              {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}
            ).read

I would say that it should be safe to not verify when dealing with a local webpack-dev-server connection but it's probably more savvy to check how certs are managed by webpacker, and also avoid using open-uri if possible 🙏

elia avatar Mar 10 '20 12:03 elia

@elia You have suggested a temporary solution for this. Closing the issue for now.

alkesh26 avatar Nov 07 '22 07:11 alkesh26