You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm developing an API using the latest dockerize with the Alpine version of FrankenPHP (dunglas/frankenphp:latest-alpine) and I use Mercure to synchronize data with my front-end application built with React.
But I encountered the error bellow which seems to be trigger randomly when the front application subscribe to the the topic.
The PHP app is not directly exposes to internet, because I have many others applications which are running in containers on the server. The PHP app is connected to an containerized load-balancer build with Caddy2 which expose the service.
// Caddyfile from the loadbalance:
fake.api.w-ap.dev {
reverse_proxy internal-php-app-with-mercure:80
}
// Caddyfile from the PHP app
{
frankenphp {
{$FRANKENPHP_CONFIG}
}
order mercure after encode
order vulcain after reverse_proxy
order php_server before file_server
}
http://fake.api.w-ap.dev {
log {
# Redact the authorization query parameter that can be set by Mercure
format filter {
wrap console
fields {
uri query {
replace authorization REDACTED
}
}
}
}
root * /srv/app/public
encode zstd gzip
mercure {
# Transport to use (default to Bolt)
transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db}
# Publisher JWT key
publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG}
# Subscriber JWT key
subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG}
# Allow anonymous subscribers (double-check that it's what you want)
anonymous
# Enable the subscription API (double-check that it's what you want)
subscriptions
# Extra directives
cors_origins https://fake.api.w-ap.dev
}
vulcain
# Add links to the API docs and to the Mercure Hub if not set explicitly (e.g. the PWA)
header ?Link `</docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation", </.well-known/mercure>; rel="mercure"`
# Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics
header ?Permissions-Policy "browsing-topics=()"
php_server
}
When I disconnect and then take a few seconds before reconnecting, everything works as expected. However, if the reconnection happens too quickly, it leads to a server crash. I have implemented a debounce mechanism to ensure that the subscription only occurs once each time the app is reloaded.
Could this problem be related to an issue with the front-end implementation? Is there something I might have overlooked?
Thank you for your assistance.
The text was updated successfully, but these errors were encountered:
Hello,
I'm developing an API using the latest dockerize with the Alpine version of FrankenPHP (
dunglas/frankenphp:latest-alpine
) and I use Mercure to synchronize data with my front-end application built with React.But I encountered the error bellow which seems to be trigger randomly when the front application subscribe to the the topic.
The PHP app is not directly exposes to internet, because I have many others applications which are running in containers on the server. The PHP app is connected to an containerized load-balancer build with Caddy2 which expose the service.
When I disconnect and then take a few seconds before reconnecting, everything works as expected. However, if the reconnection happens too quickly, it leads to a server crash. I have implemented a debounce mechanism to ensure that the subscription only occurs once each time the app is reloaded.
Could this problem be related to an issue with the front-end implementation? Is there something I might have overlooked?
Thank you for your assistance.
The text was updated successfully, but these errors were encountered: