cancel
Showing results for 
Search instead for 
Did you mean: 

OData services stopped working after deployment of attachments plugin

naveenvishal
Contributor

Hi,

I have deployed a CAP application on production with reads data from SuccessFactors and it works fine.

Additionally, I have to use Attachment plugin (cap-js/attachments (github.com)) for file upload. The attachment plugin works fine on development without breaking anything.

The issue occurred when I deployed the attachment changes to production, where attachment plugin is working fine but it has causes SuccessFactors OData calls to stop working. 

The changes that I did for adding attachments plugin is 1. CDS changes to include attachment plugin and 2. including it in package.json.

Please suggest where else I need to adjust so that this plugin does not conflict with the OData calls.  

naveenvishal_0-1715996972205.png

Thanks and Regards,

Naveen

MioYasutake
Active Contributor
0 Kudos

@naveenvishal

Let me confirm the following points:

  • Is it only the /User API that fails to connect out of the two APIs (/User, /Background_SpecialAssign)?
  • You mentioned that errors occur in the "production" environment. By "production," do you mean the Cloud Foundry Runtime, or do you mean that it only fails in the prod environment among multiple Cloud Foundry Runtime environments (dev, qas, prod)?
  • Do you see any error logs in the backend ? (by command `cf logs <your-service-name> --recent')
naveenvishal
Contributor
0 Kudos

Hi @MioYasutake ,

Please find the details:

Is it only the /User API that fails to connect out of the two APIs (/User, /Background_SpecialAssign)? The other API I cannot check until we bypass User API call. User API call is before we save to pull SF data and /Background_SpecialAssign when we save the data.

You mentioned that errors occur in the "production" environment. By "production," do you mean the Cloud Foundry Runtime, or do you mean that it only fails in the prod environment among multiple Cloud Foundry Runtime environments (dev, qas, prod)? I meant CF Runtime as we have only 1 (Dev) environment where I am test-building the application.

Do you see any error logs in the backend ? (by command `cf logs <your-service-name> --recent') -> Please find attached below the file with errors.

Thank you,

Naveen Vishal

Accepted Solutions (0)

Answers (8)

Answers (8)

MioYasutake
Active Contributor
0 Kudos

@naveenvishal 

I was able to reproduce your issue. In fact, it was not the matter of consuming external service, but the whole event handler code is getting ignored once the plugin is enabled.

I have created a new issue in the Git repository.

https://github.com/cap-js/attachments/issues/52

naveenvishal
Contributor
0 Kudos

Wow ! Many Thanks @MioYasutake for taking the deep dive. I hope they resolve it soon. Thanks again ! ~Naveen Vishal

MioYasutake
Active Contributor
0 Kudos

@naveenvishal 

Can you reproduce the issue locally by the method described in the document below?

https://cap.cloud.sap/docs/guides/using-services#mock-remote-service-as-odata-service-node-js

If you can reproduce the issue, then you can provide your project as a reference in the issue you raised.

https://github.com/cap-js/attachments/issues/50

 

naveenvishal
Contributor
0 Kudos

Hi Mio,

I tried to replicate the issue again locally but strangely its working on locally but not on deployment.

naveenvishal
Contributor
0 Kudos

Hi @MioYasutake,

The only this additionally I have observed is that, strangely, only by the inclusion of attachments with statement 'using { Attachments } from '@cap-js/attachments';' is causing the OData service to stop on deployment.

KazuhikoTakata
Active Participant
0 Kudos

Hi @naveenvishal,

Could you add service key to XSUAA instance in mta.yaml?

 

- name: uaa_sfsf-projman
  type: org.cloudfoundry.managed-service
  parameters:
    path: ./xs-security.json
    service: xsuaa
    service-name: sfsf-projman-xsuaa-service
    service-plan: application
    service-keys:
        - name: uaa_sfsf-projman-key

 

naveenvishal
Contributor
0 Kudos

Hi @KazuhikoTakata,

I have done the changes and deployed again. The issue still persists when deployed.

naveenvishal
Contributor
0 Kudos

Hi @MioYasutake ,

The event handlers are implemented in file handlers.js, called from projman-service.js.

Please find the attached files.

naveenvishal
Contributor
0 Kudos

Hi @KazuhikoTakata,

I updated the mta.yaml as suggested (attached) and deployed but the issue still persists. F4 help for getting SF Odata API works on Dev but not when deployed.

I am still trying to figure out the issue, but this is strange.

KazuhikoTakata
Active Participant
0 Kudos
Could you try to add service key to XSUAA instance?
KazuhikoTakata
Active Participant
0 Kudos

Hi @naveenvishal,

Now I understand your point. I had similar issue for connecting OData service in Cloud Foundry environment, and that was caused by whether you describe destination of Node.js service (in your case sfsf-projman-app-api) in mta.yaml. 

Now you described in resources > sfsf-projman-destination > parameters > config > init_data > instance > destinations. That is cause of trouble I think.
Could you try to describe destination in modules > sfsf-projman-destination-content > parameters > content > instance > destination? My repository above is helpful.

Best regards,

Kazuhiko Takata.

KazuhikoTakata
Active Participant
0 Kudos

Hi @naveenvishal,

Today I posted Extend Upload Set with Table to Fiori Elements and utilize Object Store that describes how to deploy cap-js/attachment program. Please check if this helps you.

Best regards,

Kazuhiko Takata

naveenvishal
Contributor
0 Kudos

Hi @KazuhikoTakata ,

Many thanks for the reply.

I have seen your blog, it is very well articulated and informative. I know it will help and guide many people. 🙂

In my case, attachments addon is working fine, but when deployed it has override/ somehow stopped the SF User OData API calls and strangely it is working fine on DEV/ (before deployment). I am unable to track the issue for now.

naveenvishal
Contributor
0 Kudos

Hi @MioYasutake ,

Please find the details:

  • Is it only the /User API that fails to connect out of the two APIs (/User, /Background_SpecialAssign)? The other API I cannot check until we bypass User API call. User API call is before we save to pull SF data and /Background_SpecialAssign when we save the data.
  • You mentioned that errors occur in the "production" environment. By "production," do you mean the Cloud Foundry Runtime, or do you mean that it only fails in the prod environment among multiple Cloud Foundry Runtime environments (dev, qas, prod)? I meant CF Runtime as we have only 1 (Dev) environment where I am test-building the application. 
  • Do you see any error logs in the backend ? (by command `cf logs <your-service-name> --recent') -> Please find attached below the file with errors

Thank you,

Naveen Vishal

MioYasutake
Active Contributor
0 Kudos

@naveenvishal

Looking at the log you provided, I found the following message:

"Error: Entity \"sfsf.projman.service.ProjectManager.SFSF_User\" is annotated with \"@cds.persistence.skip\" and cannot be served generically."

This error occurs when an event handler for an entity based on an external service is not implemented, as explained in this link. Have you implemented the event handler for SFSF_User?

 

naveenvishal
Contributor
0 Kudos

Hi Mio, you are correct, the issue "Error: Entity \"sfsf.projman.service.ProjectManager.SFSF_User\" is annotated with \"@cds.persistence.skip\" and cannot be served generically." comes when event is not handled. Strangely, looks like somehow event handler not reachable or unhandled event being raised on deploy.

Somehow the inclusion of attachments plugin causing the event/OData to be overridden.