vinicinbgs / autentique-v2

PHP Package for Autentique API-v2 | Ref: https://docs.autentique.com.br/api/
https://beadev.net/autentique-v2/
39 stars 19 forks source link

Internal server error - Create a new document #20

Closed leandrolic closed 2 years ago

leandrolic commented 2 years ago

When I try to create a document I get the message below: {"errors":[{"message":"Internal server error","extensions":{"category":"internal"},"locations":[{"line":1,"column":108}],"path":["createDocument"]}],"data":{"createDocument":null}} NOTE: the other functions are working normally.

Code:

$documents = new Documents($_ENV['AUTENTIQUE_TOKEN']);
$folders = new Folders($_ENV['AUTENTIQUE_TOKEN']);
$attributes = [
         'document' => [
             'name' => 'NOME DO DOCUMENTO',
         ],
         'signers' => [
             [
                 'email' => 'teste@gmail.com',
                 'action' => 'SIGN',
                 ],
            ],
         'file' =>  Storage::path('teste.pdf');
     ];
print_r(json_encode($documents->create($attributes)));

How can i fix that?

vinicinbgs commented 2 years ago

Put a debug dd($response) or var_dump($response);exit(); in this line and post the result here https://github.com/vinicinbgs/autentique-v2/blob/master/src/utils/Api.php#L92

probably path in your project: vendor/vinicinbgs/autentique-v2/src/utils/Api.php

And check if the Storage::path('teste.pdf') are give the right path for the file

leandrolic commented 2 years ago

Return the same error:

"{"errors":[{"message":"Internal server error","extensions":{"category":"internal"},"locations":[{"line":1,"column":108}],"path":["createDocument"]}],"data":{"createDocument":null}} ◀"

leandrolic commented 2 years ago

The error was in the file name. I was using "teste-01.pdf". When I removed the caracter "-" the api worked. Thanks

vinicinbgs commented 2 years ago

Great! thank you too :) have a nice day

I will close the issue