Bonjour,

je suis bloqué avec l'erreur 500 Failed to send an update.

J'ai un projet avec un docker file

version: '3.7'
services:
    php:
        container_name: php
        build: docker/php
        depends_on:
            - database
            - mercure
        restart: unless-stopped
        volumes:
            - .:/srv/api:rw
            - ./docker/php/conf.d/api-platform.dev.ini/:/usr/local/etc/php/conf.d/api-platform.ini
            - ./var:/srv/api/var:rw
        environment:
            APP_ENV: dev
            MERCURE_PUBLISH_URL: http://mercure/.well-known/mercure
        healthcheck:
            interval: 10s
            timeout: 3s
            retries: 3
            #start_period: 30s
        networks:
            - dev

    nginx:
        build: docker/nginx
        depends_on:
            - php
        volumes:
            - ./public:/srv/api/public:ro
            # next line file default.dev.conf is used
            - ./docker/nginx/conf.d/default.dev.conf:/etc/nginx/conf.d/default.conf
        ports:
            - "8000:80"
        networks:
            - dev

    mercure:
        image: dunglas/mercure
        restart: unless-stopped
        environment:
            SERVER_NAME: ':80'
            MERCURE_PUBLISHER_JWT_KEY: '!ChangeMe!'
            MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeMe!'
            # Set the URL of your Symfony project (without trailing slash!) as value of the cors_origins directive
            MERCURE_EXTRA_DIRECTIVES: |
                cors_origins http://127.0.0.1:8000
        # Comment the following line to disable the development mode
        command: /usr/bin/caddy run -config /etc/caddy/Caddyfile.dev
        volumes:
            - mercure_data:/data
            - mercure_config:/config
        ports:
            - 8001:80

networks:
    dev:

volumes:
    db-data:
    mercure_data:
    mercure_config:

Seulement quand je fais un POST sur cette action

/**
     * @Route("/api/publish")
     */
    public function publish(HubInterface $hub): Response
    {
        $update = new Update(
            'https://example.com/books/1',
            json_encode(['status' => 'OutOfStock'])
        );

        $hub->publish($update);

        return new Response('published!');
    }

j'ai toujours l'erreur 500. Je ne sais pas si j'ai mal configuré mercure ou si mon publish est incorrect.

Merci d'avance pour votre aide

Aucune réponse