[Bug]: Delete row or Bulk Delete with Hapi and TypeORM
Contact Details
No response
What happened?
- Start a new project.
- Install Hapi and TypeORM as the plugin and adapter (as per the docuemention).
- Create a new entry.
- Try to delete the entry
- Error - 415 (Unsupported Media Type)
Bug prevalence
Always
AdminJS dependencies version
"devDependencies": { "@types/node": "^16.18.61", "ts-node": "10.9.1", "typescript": "4.5.2" }, "dependencies": { "@adminjs/hapi": "^7.0.1", "@adminjs/typeorm": "^5.0.0", "@hapi/boom": "^10.0.1", "@hapi/cookie": "^12.0.1", "@hapi/hapi": "^21.3.2", "@hapi/inert": "^7.1.0", "adminjs": "^7.3.0", "pg": "^8.11.3", "reflect-metadata": "^0.1.13", "typeorm": "^0.3.17" },
What browsers do you see the problem on?
Firefox, Chrome, Safari, Microsoft Edge
Relevant log output
AxiosError {message: 'Request failed with status code 415', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}
Relevant code that's giving you issues
No response
I have also tried to copy the request into Postman and I faced the same issue. A workaround in Postman was to pass id in the body as part of the Post request as form-data.
Are there any errors appearing in the server's console besides the Axios error in the browser's console?
A workaround in Postman was to pass id in the body as part of the Post request as form-data.
The delete endpoint actually uses request params to get recordId. The bulkDelete endpoint uses ?recordIds query params. Could you try sending a Postman request with some random stuff in the body? Example: { "abc": "123" }. I wonder if 415 is thrown because the frontend sends an empty body in POST request, other frameworks respect this though 🤔