certifi / erlang-certifi

SSL Certificates for Erlang
Other
132 stars 33 forks source link

Allow rebar3 compilation on Windows #15

Closed ferd closed 7 years ago

ferd commented 7 years ago

Since we can't assume (for rebar3 at least) that Make or gmake is available, we instead offload the work to an escript.

The escript is a copy of the existing certs_spec/gen_certifi_mod.escript but runs relative to the library's own root instead in order to yield predictable results, the expected context for a rebar3 hook.

Should fix #14 in a portable manner, and once on hex could allow rebar3 to update its set of root certs.

deehuey commented 7 years ago

Hey! I'm getting the following error:

[info] Sent 500 in 469ms
[error] #PID<0.576.0> running StoreAPI.Web.Endpoint terminated
Server: localhost:4000 (http)
Request: POST /graphql
** (exit) an exception was raised:
    ** (UndefinedFunctionError) function :certifi_cacerts.ders/0 is undefined (module :certifi_cacerts is not available)
        :certifi_cacerts.ders()
        (hackney) c:/Users/Dan/code/tokein_platform/deps/hackney/src/hackney_connect.erl:287: :hackney_connect.ssl_opts/2
        (hackney) c:/Users/Dan/code/tokein_platform/deps/hackney/src/hackney_connect.erl:242: :hackney_connect.do_connect/5
        (hackney) c:/Users/Dan/code/tokein_platform/deps/hackney/src/hackney_connect.erl:37: :hackney_connect.connect/5
        (hackney) c:/Users/Dan/code/tokein_platform/deps/hackney/src/hackney.erl:315: :hackney.request/5
        (httpoison) lib/httpoison/base.ex:432: HTTPoison.Base.request/9
        (httpoison) lib/httpoison.ex:66: HTTPoison.request!/5
        (store) lib/store/geo/geocode.ex:7: Store.Geocode.all_info/1
        (store) lib/store/geo/geocode.ex:61: Store.Geocode.address_components/1
        (store) lib/store/geo/geocode.ex:66: Store.Geocode.get_locality/1
        (store_api) lib/store_api/web/resolvers/store/geocode_resolver.ex:5: StoreAPI.Resolvers.Geocode.get_locality/3
        (absinthe) lib/absinthe/resolution.ex:147: Absinthe.Resolution.call/2
        (absinthe) lib/absinthe/phase/document/execution/resolution.ex:191: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1
        (absinthe) lib/absinthe/phase/document/execution/resolution.ex:161: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/4
        (absinthe) lib/absinthe/phase/document/execution/resolution.ex:147: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6
        (absinthe) lib/absinthe/phase/document/execution/resolution.ex:87: Absinthe.Phase.Document.Execution.Resolution.walk_result/5
        (absinthe) lib/absinthe/phase/document/execution/resolution.ex:57: Absinthe.Phase.Document.Execution.Resolution.perform_resolution/3
        (absinthe) lib/absinthe/phase/document/execution/resolution.ex:25: Absinthe.Phase.Document.Execution.Resolution.resolve_current/3
        (absinthe) lib/absinthe/pipeline.ex:247: Absinthe.Pipeline.run_phase/3
        (absinthe_plug) lib/absinthe/plug.ex:250: Absinthe.Plug.run_query/3

I assume this would possibly fix this issue? Is there a way I can run this locally? I can't perform a simple HTTPS request on windows 10. Looking for a solution as I'm blocked helping my team by this. ( They all use macs :P )

benoitc commented 7 years ago

@ferd using the script on all platform sounds like a good idea. I will make some tests in the morning. Thanks for the patch!

josevalim commented 7 years ago

I have sent a PR that removes the need for the Makefile altogether and reduces the size of the .beam in more than 50%: #17.

benoitc commented 7 years ago

@josevalim thanks!

@ferd closing this PR, i applied #17 since it fix mosts cases around without counting the reduction of the size.