Category Archives: Drupal 8

Could not denormalize object of type , no supporting normalizer found.

I tried to create a custom Rest API with Drupal 8 and it was working great with GET operations. Problem is I wanted more, what about POST, PATCH, PUT, DELETE, … operations ?

Only GET examples were found about Drupal Rest API and nobody had any explanation about this POST response error:

Could not denormalize object of type , no supporting normalizer found.

So I had a look in Drupal Core and found out you need this interesting serialization_class comment annotation. Example with EntityResource:

Actually, if you implement GET, you don’t need this serialization_class to be filled because you only deal with primitive types, but if you want to implement something else like POST, PUT, …, this should be filled with an EntityType so Drupal would be able to understand and cast your parameters to the destination Entity.

Example, you create a VoteEntity and you need to implement GET and POST Rest apis, this should do the trick:

 

Hope this helps.

Failed to get available update data for one project.

I had a problem updating modules in my new Drupal 8 install. This error appeared each time Drupal wanted to do a full update check. It couldn’t even find new version available.

Failed to get available update data.

drupal8error

In Drupal recent log entries I found there was an error with curl and ssl verification:

GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in GuzzleHttp\Handler\CurlFactory::createRejection() (line 187of C:\www\drupal8\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php).

It seems curl doesn’t have valid certificate authorities for SSL Validation. So I downloaded this cacert.pem I put in C:\Windows\ and added a php.ini setting:

Then restart your web server and try again a manual update check in Drupal.

It should be fixed !

drupal8ok