Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongoosepush start error #131

Closed
raobilal28 opened this issue Dec 15, 2019 · 5 comments · Fixed by #217
Closed

mongoosepush start error #131

raobilal28 opened this issue Dec 15, 2019 · 5 comments · Fixed by #217

Comments

@raobilal28
Copy link

HI
i am trying to start mongoosepush with below docker command.
docker run -p 8443:8443 -v pwd/priv:/opt/mongoosepush/priv
-e PUSH_FCM_APP_KEY="my_key"
-e PUSH_HTTPS_CERTFILE="/opt/mongoosepush/priv/ssl/rest_cert.pem"
-e PUSH_HTTPS_KEYFILE="/opt/mongoosepush/priv/ssl/rest_key.pem"
-it --rm mongooseim/mongoose-push:latest

But i am getting this error. please help to resolve this.

2019-12-15T00:22:14.228 [error] pid=<0.1792.0> Required authentication elements are missing. Got:
key=, team=, p8_file=/opt/app/lib/mongoose_push-2.0.0-beta.2/priv/apns/token.p8

2019-12-15T00:22:14.228 [error] pid=<0.1792.0> Required authentication elements are missing. Got:
key=, team=, p8_file=/opt/app/lib/mongoose_push-2.0.0-beta.2/priv/apns/token.p8

=SUPERVISOR REPORT==== 15-Dec-2019::00:22:14.244279 ===
supervisor: {local,gr_param_sup}
errorContext: child_terminated
reason: killed
offender: [{pid,<0.1556.0>},
{id,gr_lager_default_tracer_params},
{mfargs,{gr_param,start_link,[gr_lager_default_tracer_params]}},
{restart_type,transient},
{shutdown,brutal_kill},
{child_type,worker}]
{"Kernel pid terminated",application_controller,"{application_start_failure,mongoose_push,{{shutdown,{failed_to_start_child,apns_supervisor,{bad_return,{'Elixir.MongoosePush.Service.APNS.Supervisor',init,{stop,bad_auth}}}}},{'Elixir.MongoosePush.Application',start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,mongoose_push,{{shutdown,{failed_to_start_child,apns_supervisor,{bad_return,{'Elixir.MongoosePush.Service.APNS.Supervisor',in

@rslota
Copy link
Contributor

rslota commented Dec 16, 2019

Hi @raobilal28 ,

The error states:

2019-12-15T00:22:14.228 [error] pid=<0.1792.0> Required authentication elements are missing. Got:
key=, team=, p8_file=/opt/app/lib/mongoose_push-2.0.0-beta.2/priv/apns/token.p8

which clearly means that your FCM token is miss-configured. Please refer to the documentation on how to properly setup FCM.

Also, you seem to be using latest tag for docker image - this is highly discouraged, as this tag always points to the latest release which may contain breaking changes (recently 2.0.0 release that changed e.g. FCM API that is being used). It's recommended to pick a release and use proper docker image tag for this specific release to avoid unwanted updates.

@raobilal28
Copy link
Author

raobilal28 commented Jan 9, 2020

On using release tag i get this error:
Unable to find image 'mongooseim/mongoose-push:release' locally
docker: Error response from daemon: manifest for mongooseim/mongoose-push:release not found: manifest unknown: manifest unknown.

and on latest tag, this starting error. please suggest.

docker run -v pwd/priv:/opt/app/priv -p 8443:8443 -e PUSH_FCM_APP_KEY="my_key" -e PUSH_HTTPS_CERTFILE="/opt/app/priv/ssl/rest_cert.pem" -e PUSH_HTTPS_KEYFILE="/opt/app/priv/ssl/rest_key.pem" -it --rm mongooseim/mongoose-push:latest

2020-01-09T02:57:43.851 [info] pid=<0.1578.0> [msg: 'Starting reporters with []\n', options: []]
warning: Plug.Adapters.Cowboy2 is deprecated, please use Plug.Cowboy instead
(plug) lib/plug/adapters/cowboy2.ex:33: Plug.Adapters.Cowboy2.child_spec/1
(maru) lib/maru/supervisor.ex:18: anonymous fn/4 in Maru.Supervisor.init/1
(elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
(maru) lib/maru/supervisor.ex:16: anonymous fn/2 in Maru.Supervisor.init/1
(elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3

2020-01-09T02:57:43.853 [info] pid=<0.1634.0> Starting Elixir.MongoosePush.Router with Cowboy on https://0.0.0.0:8443

2020-01-09T02:57:43.853 [info] pid=<0.1475.0> Application maru exited: Maru.start(:normal, []) returned an error: an exception was raised:
** (ArgumentError) could not start Cowboy2 adapter, the file /opt/app/priv/ssl/rest_key.pem required by SSL's :keyfile either does not exist, or the application does not have permission to access it

note:
/opt/app/priv/ssl/rest_key.pem this self signed key exists on server.

@raobilal28
Copy link
Author

Hi,

I am able to run MongoosePush with apns/fcm. but getting below error when sending push on android.

2020-01-22T09:04:57.078 [warning] <0.1922.0> Unable to complete push request due to invalid_device_token

@ghard
Copy link

ghard commented Mar 6, 2020

2019-12-15T00:22:14.228 [error] pid=<0.1792.0> Required authentication elements are missing. Got:
key=, team=, p8_file=/opt/app/lib/mongoose_push-2.0.0-beta.2/priv/apns/token.p8


which clearly means that your FCM token is miss-configured. Please refer to the documentation on how to properly setup FCM.

How is a seemingly apns-related error message pointing clearly to a problem with a FCM token?

To me the error message seems to indicate that a p8 key is being looked for in a place that differs from what is indicated in the documentation.

I'm seeing a similar issue where although I'm passing an absolute pathname in an env var, the system insists on prepending it with some arbitrary path. In my case:

-e PUSH_APNS_PROD_P8_TOKEN=/priv/apns/my_token.p8

and the error message has:

p8_file=/opt/app/lib/mongoose_push-2.0.2/opt/app/priv/apns/my_token.p8

To prove the observation I changed the ENV var to:

-e PUSH_APNS_PROD_P8_TOKEN=/../../priv/apns/my_token.p8

and looks like it found the token where I expected.

@rslota
Copy link
Contributor

rslota commented Mar 12, 2020

@ghard @raobilal28 ,

I'm sorry, I confused FCM with APNS here - indeed this is APNS related issue.

@raobilal28 ,

Please go to https://github.com/esl/MongoosePush/releases and pick the latest 1.0.x release if you want to use legacy MongoosePush (your configuration suggests this). Right now that would be docker tag 1.0.6.

@ghard ,

This indeed sounds like a bug. I can't reproduce the with additional /opt/app/, but I'll keep digging. At the very least, absolute paths should not be extended.

@pawlooss1 pawlooss1 linked a pull request Apr 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants