inaka/apns4erl

apns:connect error

Akick opened this issue · 3 comments

Akick commented

Erlang 22. gun - master, apns4erl - master.
I do all as in the example.

But:
apns:connect(#{name => another_cert, apple_host => "api.push.apple.com", apple_port => 443, certfile => "priv/aps.pem", keyfile => "priv/AuthKey.pem", type => cert}).
and
apns:connect(cert, another_connection).

{ok, pid()}
19:43:32.909 [error] gen_statem another_connection in state open_common terminated with reason: {{badmatch,{error,{options,{transport_opts,[{certfile,"./keys/aps.pem"},{keyfile,"./keys/AuthKey.pem"}]}}}},state_functions}
19:43:32.909 [error] CRASH REPORT Process another_connection with 0 neighbours crashed with reason: no match of right hand value {error,{options,{transport_opts,[{certfile,"./keys/aps.pem"},{keyfile,"./keys/AuthKey.pem"}]}}} in apns_connection:open_common/3 line 254
19:43:32.910 [error] Supervisor apns_sup had child apns_connection started with {apns_connection,start_link,undefined} at <0.2390.0> exit with reason no match of right hand value {error,{options,{transport_opts,[{certfile,"./keys/aps.pem"},{keyfile,"./keys/AuthKey.pem"}]}}} in apns_connection:open_common/3 line 254 in context child_terminated

If I call apns:connect(token, another_connection) I get:
19:48:30.123 [error] gen_statem another_connection in state open_common terminated with reason: {{badmatch,{error,{options,{transport_opts,[]}}}},state_functions}
19:48:30.123 [error] CRASH REPORT Process another_connection with 0 neighbours crashed with reason: no match of right hand value {error,{options,{transport_opts,[]}}} in apns_connection:open_common/3 line 254
19:48:30.123 [error] Supervisor apns_sup had child apns_connection started with {apns_connection,start_link,undefined} at <0.3103.0> exit with reason no match of right hand value {error,{options,{transport_opts,[]}}} in apns_connection:open_common/3 line 254 in context child_terminated.

What am I doing wrong?

@Akick do you mind sending a pull request with that change?
Thanks.