Referencing Delete in entity-storage
I just encountered the same problem while running a serverless app with FDK 9.2.0 and traced the problem to the deprecated request NPM package. The problem occurs on line 1145 of nodejs/18.20.1/lib/node_modules/fdk/node_modules/request/request.js
response.body is undefined because the delete request returns an empty body. Since the library has been deprecated for 5 years I seriously doubt it will ever be fixed upstream. The fix should be to change the response to an empty JSON object or some sort of acknowledgement that the item was actually deleted.
I’ve confirmed that changing line 127 of nodejs/18.20.1/lib/node_modules/fdk/lib/api/record.js from:
return res.status(httpUtil.status.no_content).send();
to
return res.status(httpUtil.status.ok).send({});
eliminates the undefined error reported.
So it seems like there are 4 solutions here:
- Replace the requests package with a non-deprecated package with active maintenance.
- Apply the fix that I reported.
- Apply a different fix (report the number of rows deleted, etc.).
- Do nothing.
Item 1 should probably happen regardless, but I understand that would entail a major engineering effort. Still, it was deprecated 5 years ago, so …
Item2 seems like low hanging fruit and, without testing in production, shouldn’t break things. I’m worried that item 4 may be the result as the original problem was reported over 2 years ago.