cap-js / sdm

CAP Plugin for SAP Document Management service
Apache License 2.0
8 stars 1 forks source link

502 Bad Gateway error when upload a file. #71

Open hakanalakus opened 3 days ago

hakanalakus commented 3 days ago

I implemented it as written in the document. Also i created a non versioned repo in dms. When i upload a file it throws an error. UI part shows the 502 bad gateway error "502 Bad Gateway: Registered endpoint failed to handle the request.".

Cap js srv app logs:

  1. "msg": "❗️Uncaught TypeError: Cannot read properties of undefined (reading 'getTokenValue')\n at SDMAttachmentsService.draftSaveHandler (/home/vcap/app/node_modules/@cap-js/sdm/lib/sdm.js:83:28)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Promise.all (index 3)\n at async ApplicationService.handle (/home/vcap/app/node_modules/@sap/cds/lib/srv/srv-dispatch.js:69:5)\n at async cds.ApplicationService.handle (/home/vcap/app/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js:317:20)\n at async /home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js:53:16 {\n id: '1964757',\n level: 'ERROR',\n timestamp: 1726600488180\n}"
  2. "msg": "Invalid value \"undefined\" in content-type header", "stacktrace": [ "DeserializationError: Invalid value \"undefined\" in content-type header", "at RequestContentNegotiator.negotiate (/home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/RequestContentNegotiator.js:36:15)", "at DeserializingCommand.execute (/home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DeserializingCommand.js:43:39)", "at CommandExecutor._execute (/home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/CommandExecutor.js:71:17)", "at /home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/CommandExecutor.js:81:18", "at PresetResponseHeadersCommand.execute (/home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/PresetResponseHeadersCommand.js:43:5)", "at CommandExecutor._execute (/home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/CommandExecutor.js:71:17)", "at /home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/CommandExecutor.js:81:18", "at LocaleNegotiatorCommand.execute (/home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/LocaleNegotiatorCommand.js:51:7)", "at CommandExecutor._execute (/home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/CommandExecutor.js:71:17)", "at /home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/CommandExecutor.js:81:18" ]
rashmiangadi11 commented 1 day ago

Hi, Could you please tell me whether you are running this locally or deployed to BTP.

Regards, Rashmi

hakanalakus commented 1 day ago

Hi, App was Deployed on BTP. sap/cds version is ^8 , fiori version is 1.122.0.

rashmiangadi11 commented 1 day ago

Hi Hakan, could you please schedule a meeting today so that we can check the configuration and where is the flow breaking.

Regards, Rashmi

hakanalakus commented 1 day ago

Hi , yes of course. Can you meet me at any time you are available? hakan.alakus@appic.com.tr

rashmiangadi11 commented 23 hours ago

Hi Hakan, I tried the code you sent and its working fine for me i am able to see the credentials. Could you please check if you have done cf login and then do you have permission in that space. Also could you please replace your cdsrc.private.json file content with below and check if you are able to get the credentials { "requires": { "[hybrid]": { "attachments": { "binding": { "type": "cf", "apiEndpoint": "https://api.cf.eu10.hana.ondemand.com", "org": "TP-OTC (TP Offshore Technology Center)_dev1ain", "space": "ENTERPRISE_APPS", "instance": "Document-Management-2", "key": "Document-Management-2-key", "resolved": false }, "kind": "sdm", "vcap": { "name": "attachments" } } } } }