inaka/apns4erl

Function not exported {string,lowercase,1}

Opened this issue · 3 comments

Hi, I'm using Kazoo's Puscher to send iOS notifications by apns4erl.
When the apns starts I got this error:

09:14:35.930 [error] |0000000000|Undefined:Undefined(<0.4836.510>) gen_statem 'apns_test' in state connected terminated with reason: {'function not exported',{string,lowercase,1}} in gun:normalize_headers/1 line 661
09:14:35.930 [error] |0000000000|string:Undefined(<0.4836.510>) CRASH REPORT Process 'apns_test' with 0 neighbours crashed with reason: call to undefined function string:lowercase(<<"apns-topic">>)
09:14:35.930 [error] |0000000000|Undefined:Undefined(<0.3440.510>) Supervisor apns_sup had child apns_connection started with {apns_connection,start_link,undefined} at <0.4836.510> exit with reason undef in context child_terminated
09:14:35.933 [error] |0000000000|Undefined:Undefined(<0.3623.510>) gen_server pm_apple terminated with reason: {undef,{gen_statem,call,[<0.4836.510>,{push_notification,<<"ac79eb0d7f28ee04d3539b80a3b6f519cc3db78e7b3840f18b497fadcedc5264">>,<<"{\"aps\":{\"alert\":{\"loc-args\":[\"1089 - Dario Test3\"],\"loc-key\":\"IC_SIL\"},\"call-id\":\"2d1ce4d3-282b-4409-a2ad-01dd021aff6a\",\"sound\":\"ring.caf\"},\"call-id\":\"2d1ce4d3-282b-4409-a2ad-01dd021aff6a\",\"caller-id-name\":\"Dario Test3\",\"caller-id-number\":\"1089\",\"proxy\":\"sip:94.138.35.201:5060\",\"registration-token\":\"18647b19-1e86-48e0-bd5b-66f72d73873f\",\"utc_unix_timestamp_ms\":\"164...">>,...},...]}} in gen:do_call/4 line 177
09:14:35.934 [error] |0000000000|Undefined:Undefined(<0.3623.510>) CRASH REPORT Process pm_apple with 0 neighbours exited with reason: {undef,{gen_statem,call,[<0.4836.510>,{push_notification,<<"ac79eb0d7f28ee04d3539b80a3b6f519cc3db78e7b3840f18b497fadcedc5264">>,<<"{\"aps\":{\"alert\":{\"loc-args\":[\"1089 - Dario Test3\"],\"loc-key\":\"IC_SIL\"},\"call-id\":\"2d1ce4d3-282b-4409-a2ad-01dd021aff6a\",\"sound\":\"ring.caf\"},\"call-id\":\"2d1ce4d3-282b-4409-a2ad-01dd021aff6a\",\"caller-id-name\":\"Dario Test3\",\"caller-id-number\":\"1089\",\"proxy\":\"sip:94.138.35.201:5060\",\"registration-token\":\"18647b19-1e86-48e0-bd5b-66f72d73873f\",\"utc_unix_timestamp_ms\":\"164...">>,...},...]}} in gen_server:terminate/7 line 812
09:14:35.935 [error] |0000000000|Undefined:Undefined(<0.3684.510>) Supervisor pusher_module_sup had child pm_apple started with pm_apple:start_link() at <0.3623.510> exit with reason {undef,{gen_statem,call,[<0.4836.510>,{push_notification,<<"ac79eb0d7f28ee04d3539b80a3b6f519cc3db78e7b3840f18b497fadcedc5264">>,<<"{\"aps\":{\"alert\":{\"loc-args\":[\"1089 - Dario Test3\"],\"loc-key\":\"IC_SIL\"},\"call-id\":\"2d1ce4d3-282b-4409-a2ad-01dd021aff6a\",\"sound\":\"ring.caf\"},\"call-id\":\"2d1ce4d3-282b-4409-a2ad-01dd021aff6a\",\"caller-id-name\":\"Dario Test3\",\"caller-id-number\":\"1089\",\"proxy\":\"sip:94.138.35.201:5060\",\"registration-token\":\"18647b19-1e86-48e0-bd5b-66f72d73873f\",\"utc_unix_timestamp_ms\":\"164...">>,...},...]}} in context child_terminated

It seems that I've a OTP version less than 20 but I have the 22:

Erlang/OTP 22 [erts-10.7.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Anyone can help me please?

You will need to use an older version of apns4erl. We don't support OTP22 in the latest ones.

Actually… Our rebar.config says we do:

{minimum_otp_vsn, "19"}.

🤦🏻

It seems like the upgrade of gun introduced in #237 indeed had stuff that broke backwards compatibility. 🤷🏻

If it was me, I would just bump minimum_otp_vsn to 23 or something, but I'll defer to @ferigis for proper solutions to this.

I'm using apns-2.4.0 and gun-2.0.0-pre.2. Should I use apns4erl 1.0.6-final? I'll wait the @ferigis solution. Thank you very much.