orangehrm / orangehrm

OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures all the essential functionalities required for any enterprise.
GNU General Public License v3.0
740 stars 538 forks source link

Error when upload attachments to Claim #1820

Open dferraes opened 2 months ago

dferraes commented 2 months ago

OrangeHRM version

5.6

Environment details

Describe the bug

When you try to upload a new attachment, after you click the Save button, an error is displayed with the text:

Error Unexpected error occured

To reproduce

  1. Create new claim
  2. Try to upload a new file

Expected behavior

  1. Create new claim
  2. Upload file

Relevant log output

[2024-03-06T17:32:17.617194+00:00] orangehrm.ERROR: Transaction Failed [] []
[2024-03-06T17:32:17.617336+00:00] orangehrm.ERROR: #0 /var/www/clients/client1/web19/web/src/plugins/orangehrmCorePlugin/Controller/Rest/V2/GenericRestController.php(112): OrangeHRM\Claim\Api\ClaimAttachmentAPI->create() #1 /var/www/clients/client1/web19/web/src/plugins/orangehrmCorePlugin/Controller/Rest/V2/AbstractRestController.php(149): OrangeHRM\Core\Controller\Rest\V2\GenericRestController->handlePostRequest() #2 /var/www/clients/client1/web19/web/src/vendor/symfony/http-kernel/HttpKernel.php(152): OrangeHRM\Core\Controller\Rest\V2\AbstractRestController->handle() #3 /var/www/clients/client1/web19/web/src/vendor/symfony/http-kernel/HttpKernel.php(74): Symfony\Component\HttpKernel\HttpKernel->handleRaw() #4 /var/www/clients/client1/web19/web/src/lib/framework/Framework.php(156): Symfony\Component\HttpKernel\HttpKernel->handle() #5 /var/www/clients/client1/web19/web/web/index.php(41): OrangeHRM\Framework\Framework->handleRequest() #6 {main} [] []
devishke-orange commented 2 months ago

Hi @dferraes

Thank you for including the log. Are you seeing this behaviour throughout the system (i.e. where attachments can be uploaded) or only in the Claim module?

dferraes commented 2 months ago

Hi @devishke-orange,

I uploaded files in the PIM section without problems, only in Claim module I got that error. My installation is a new installation. I got another error using the developer console:

Failed to load resource: the server responded with a status of 500 () settle.js:19 Uncaught (in promise) Qcode: "ERR_BAD_RESPONSE"config: {transitional: {…}, adapter: Array(2), transformRequest: Array(1), transformResponse: Array(1), timeout: 0, …}message: "Request failed with status code 500"name: "AxiosError"request: XMLHttpRequestonabort: ƒ ()onerror: ƒ ()onload: nullonloadend: ƒ u()onloadstart: nullonprogress: nullonreadystatechange: nullontimeout: ƒ ()readyState: 4response: "{\"error\":{\"status\":\"500\",\"message\":\"Unexpected Error Occurred\"}}"responseText: "{\"error\":{\"status\":\"500\",\"message\":\"Unexpected Error Occurred\"}}"responseType: ""responseURL: "https://xxx.xxxxx.xx/web/index.php/api/v2/claim/requests/3/attachments"responseXML: nullstatus: 500statusText: ""timeout: 0upload: XMLHttpRequestUpload {onloadstart: null, onprogress: null, onabort: null, onerror: null, onload: null, …}withCredentials: false[[Prototype]]: XMLHttpRequestresponse: config: {transitional: {…}, adapter: Array(2), transformRequest: Array(1), transformResponse: Array(1), timeout: 0, …}data: {error: {…}}headers: We {cache-control: 'no-cache, private', content-type: 'application/json', date: 'Wed, 06 Mar 2024 17:53:37 GMT', server: 'Apache', x-content-type-options: 'nosniff', …}request: XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}status: 500statusText: ""[[Prototype]]: Objectstack: "AxiosError: Request failed with status code 500\n at Qe (https://xxx.xxxxx.xx/web/dist/js/chunk-vendors.js?v=1706326081969:134:50105)\n at XMLHttpRequest.u (https://xxx.xxxxx.xx/web/dist/js/chunk-vendors.js?v=1706326081969:134:53144)"[[Prototype]]: Errorconstructor: ƒ Q(e,t,n,r,o)toJSON: ƒ ()isAxiosError: true[[Prototype]]: Object