Skip to content

Argument 1 passed to PsrHttpFactory::createRequest() must be an instance of Request, null given #87

Description

@nelson6e65

Hi. IDK if put this here or in paknahad/jsonapi-bundle, because this happens when using this extension.

I get this error (when authenticating using NelmioApiDocs or via Postman) when I use a custom Finder or paknahad/jsonapi-querifier-bundle:

[critical] Uncaught Error: Argument 1 passed to Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory::createRequest() must be an instance of Symfony\Component\HttpFoundation\Request, null given, called in ./vendor/paknahad/jsonapi-bundle/src/Factory/JsonApiFactory.php on line 45

When APP_DEBUG is set to true, this break the JSON response with the warning as plain text, so only works with APP_DEBUG=false.

Seems to be related with the requestStack, like an issue in AdactiveSAS/saml2-bridge-bundle#28

public function create(): JsonApi
{
$jsonApiRequest = new JsonApiRequest(
$this->psrFactory->createRequest($this->requestStack->getCurrentRequest()),
$this->exceptionFactory
);

https://github.com/AdactiveSAS/saml2-bridge-bundle/blob/a517b096de30416a53d5f7dc3f24a6947e743e2b/src/Entity/HostedEntities.php#L141

Maybe my config is wrong?

My services.yaml config is:

services:
  paknahad_json_api.helper_filter.finder:
    class: Paknahad\JsonApiQuerifierBundle\Finder\Querifier
    public: false
    tags:
      - { name: paknahad.json_api.finder }

Am I missing something?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions