2

I deployed a API Platform api and client using Heroku but it seems that Mercure is not working out of the box, but I think my application may have missing configuration.

The only thing I configured is this MERCURE_SUBSCRIBE_URL=http://my-random-herokuapp-name-generated.herokuapp.com/hub.

In production I'm getting 404 error on my hub address and in local I get an answer saying I didn't provide a topic (which makes sense because I just requested the address to make a test without providing any parameter).

In local environment, the full package API platform is given with a docker running a mercure server, I think this might be the answer that herokuapp doesn't support Mercure, but it's not very clear to me.

So basically I am getting a 404 not found error on the hub address instead of getting a 200

Rich Michaels
  • 1,663
  • 2
  • 12
  • 18

2 Answers2

3

To use Mercure with API Platform, you have to also deploy a Mercure hub. The hub can be downloaded on https://mercure.rocks. Then you can deploy it easily on Heroku as a Go application.

Your Procfile should look like:

web: ADDR=$PORT ./mercure
Kévin Dunglas
  • 2,864
  • 2
  • 23
  • 39
  • The correct Procfile content is `web: ADDR=":${PORT}" mercure` – Spomky-Labs Nov 21 '19 at 09:52
  • thanks for the answer, but i saw it too late and used ngrok for fast live update wow effect. But now i really need to do that, and there is still no documentation about it so i am asking this here : i followed your instructions and tried to deploy the downloaded mercure folder with correct Procfile and go build pack but got "App not compatible with buildpack" any ideas ? – alexandre-mace May 19 '20 at 21:52
  • btw there is this https://github.com/dunglas/mercure/pull/226 but i have not the required mental capacity to make it work and spread info in the doc.. – alexandre-mace May 19 '20 at 21:59
0

To everyone, even if unsecure (look at mercure doc to know more https://mercure.rocks/docs/hub/install)

this Procfile just work out of the box with heroku

web: ADDR=:$PORT ./mercure --jwt-key='!ChangeMe!' --debug --allow-anonymous --cors-allowed-origins='*' --publish-allowed-origins='*'