Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on POST and PATCH an entry in a collection #28

Open
sdussaut opened this issue May 24, 2024 · 0 comments
Open

Error on POST and PATCH an entry in a collection #28

sdussaut opened this issue May 24, 2024 · 0 comments

Comments

@sdussaut
Copy link

sdussaut commented May 24, 2024

Hi!

I don't really know where to post that one, here or directly to Statamic. As I can reproduce it with this addon, I'll post here for now.

When posting or patching an entry, the API returns a 500 error with the following message:

{
  "message": "Call to a member function blueprint() on int",
  "exception": "Error",
  "file": "/code/website/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php",
  "line": 23,
  "trace": [
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Http/Resources/DelegatesToResource.php",
      "line": 155,
      "function": "forwardCallTo",
      "class": "Illuminate\\Http\\Resources\\Json\\JsonResource",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/statamic/cms/src/Http/Resources/API/EntryResource.php",
      "line": 17,
      "function": "__call",
      "class": "Illuminate\\Http\\Resources\\Json\\JsonResource",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php",
      "line": 107,
      "function": "toArray",
      "class": "Statamic\\Http\\Resources\\API\\EntryResource",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/ResourceResponse.php",
      "line": 39,
      "function": "resolve",
      "class": "Illuminate\\Http\\Resources\\Json\\JsonResource",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php",
      "line": 244,
      "function": "toResponse",
      "class": "Illuminate\\Http\\Resources\\Json\\ResourceResponse",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 900,
      "function": "toResponse",
      "class": "Illuminate\\Http\\Resources\\Json\\JsonResource",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 885,
      "function": "toResponse",
      "class": "Illuminate\\Routing\\Router",
      "type": "::"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 805,
      "function": "prepareResponse",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 144,
      "function": "Illuminate\\Routing\\{closure}",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php",
      "line": 64,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Illuminate\\Auth\\Middleware\\Authenticate",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 119,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 805,
      "function": "then",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 784,
      "function": "runRouteWithinStack",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 748,
      "function": "runRoute",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 737,
      "function": "dispatchToRoute",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
      "line": 200,
      "function": "dispatch",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 144,
      "function": "Illuminate\\Foundation\\Http\\{closure}",
      "class": "Illuminate\\Foundation\\Http\\Kernel",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/statamic/cms/src/Http/Middleware/StopImpersonating.php",
      "line": 12,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Statamic\\Http\\Middleware\\StopImpersonating",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/statamic/cms/src/Http/Middleware/DisableFloc.php",
      "line": 17,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Statamic\\Http\\Middleware\\DisableFloc",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/statamic/cms/src/Http/Middleware/CheckMultisite.php",
      "line": 15,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Statamic\\Http\\Middleware\\CheckMultisite",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/statamic/cms/src/Http/Middleware/CheckComposerJsonScripts.php",
      "line": 14,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Statamic\\Http\\Middleware\\CheckComposerJsonScripts",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/statamic/cms/src/Http/Middleware/PoweredByHeader.php",
      "line": 18,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Statamic\\Http\\Middleware\\PoweredByHeader",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php",
      "line": 59,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Barryvdh\\Debugbar\\Middleware\\InjectDebugbar",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
      "line": 21,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php",
      "line": 31,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
      "line": 21,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php",
      "line": 51,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\TrimStrings",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php",
      "line": 27,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Illuminate\\Http\\Middleware\\ValidatePostSize",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php",
      "line": 110,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php",
      "line": 62,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Illuminate\\Http\\Middleware\\HandleCors",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php",
      "line": 57,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 183,
      "function": "handle",
      "class": "Illuminate\\Http\\Middleware\\TrustProxies",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 119,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
      "line": 175,
      "function": "then",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/code/website/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
      "line": 144,
      "function": "sendRequestThroughRouter",
      "class": "Illuminate\\Foundation\\Http\\Kernel",
      "type": "->"
    },
    {
      "file": "/code/website/public/index.php",
      "line": 51,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Kernel",
      "type": "->"
    },
    {
      "file": "/Users/sebby/.composer/vendor/laravel/valet/server.php",
      "line": 110,
      "function": "require"
    }
  ]
}

Even though I get an error, the entry is still created somehow (which is weird).

Any idea on what could be happening here?

Here is the support details in case that helps:

Environment
Application Name: Livres du Cosnier
Laravel Version: 11.8.0
PHP Version: 8.3.3
Composer Version: 2.6.6
Environment: local
Debug Mode: ENABLED
URL: livres-du-cosnier.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Simple Commerce
Currencies: EUR, EUR
Gateways: Dummy
Repository: Customer: DuncanMcClean\SimpleCommerce\Customers\EntryCustomerRepository
Repository: Order: DuncanMcClean\SimpleCommerce\Orders\EntryOrderRepository
Repository: Product: DuncanMcClean\SimpleCommerce\Products\EntryProductRepository
Shipping Methods: Free Shipping
Tax Engine: DuncanMcClean\SimpleCommerce\Tax\Standard\TaxEngine

Statamic
Addons: 5
Sites: 2 ([FR] Français, [EN] Anglais)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.5.0 PRO

Statamic Addons
aryehraber/statamic-logbook: 3.3.0
duncanmcclean/simple-commerce: 7.2.0
sdussaut/statamic-sanctum: dev-main
statamic/eloquent-driver: 4.0.0
tv2regionerne/statamic-private-api: 1.12.0

Statamic Eloquent Driver
Asset Containers: file
Assets: file
Blueprints: file
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Forms: file
Global Sets: file
Global Variables: file
Navigation Trees: file
Navigations: file
Revisions: file
Taxonomies: file
Terms: file

Thanks!

@sdussaut sdussaut changed the title Error on POSTing an entry in a collection Error on POST and PATCH an entry in a collection May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant