V8-archive: Creating item with M2M field results in Internal Server Error

Created on 28 Jul 2019  路  5Comments  路  Source: directus/v8-archive

Bug Report

Steps to Reproduce

  1. Configure rudimentary tables where one has an M2M field with defaults.
  2. POST request to API i.e. /database/collection/items with payload { "filename": "test.txt", "categories": [407, 406] }

Response:

{
  "error": {
    "code": null,
    "message": "Internal Server Error"
  }
}

Actual Behavior

Request returns "Internal Server Error"

Other Context & Screenshots

  • No errors recorded by nginx.
  • From the Directus log:
[2019-07-26 23:16:37] api[].ERROR: Directus\Exception\UnauthorizedException: Unauthorized request in /server/html/directus/src/helpers/app.php:270
Stack trace:
#0 /server/html/directus/vendor/slim/slim/Slim/App.php(530): Directus\{closure}
#1 /server/html/directus/src/core/Directus/Application/Http/Middleware/CorsMiddleware.php(66): Slim\App->__invoke
#2 [internal function]: Directus\Application\Http\Middleware\CorsMiddleware->__invoke
#3 /server/html/directus/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array
#4 [internal function]: Slim\DeferredCallable->__invoke
#5 /server/html/directus/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func
#6 /server/html/directus/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->Slim\{closure}
#7 /server/html/directus/vendor/slim/slim/Slim/App.php(405): Slim\App->callMiddlewareStack
#8 /server/html/directus/vendor/slim/slim/Slim/App.php(313): Slim\App->process
#9 /server/html/directus/src/core/Directus/Application/Application.php(161): Slim\App->run
#10 /server/html/directus/public/index.php(5): Directus\Application\Application->run [] []
  • removing the M2M field from the payload results in a successful request

Technical Details

  • Web Server: nginx 1.14.0
  • PHP Version: 7.2.17
  • Database: MySQL 8
  • Install Method: cloned master branch
bug

All 5 comments

Someone on Slack suggested I observe what /app does when creating a new item and it's very unecpected in my opinion but it does work.

App payload:

{"filename":"test.txt","categories":[{"files_categories_id":{"id":407,"name":"testcat1"}}]}

I'll leave the issue open though as I couldn't find any documentation on this and I'm not sure if it's the best solution...

I am closing this as it is not an API related but a DOC specific issue. I send PR(https://github.com/directus/docs/pull/179)

There are a lot of open tickets in the docs right now, can you update the docs for these tickets at you go @bjgajjar ? That way we know they're getting resolved and not just getting shifted to a different repo.

@benhaynes

That's what I am doing right now. Please check I added 2 PR in DOC repo :)

Haha, just saw that!! Thanks! 馃槈

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Varulv1997 picture Varulv1997  路  3Comments

cdwmhcc picture cdwmhcc  路  3Comments

24js picture 24js  路  3Comments

HashemKhalifa picture HashemKhalifa  路  3Comments

cdwmhcc picture cdwmhcc  路  3Comments