Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot read properties of undefined (reading 'uaa') #75

Open
AelElliotBanyard opened this issue Oct 10, 2024 · 21 comments
Open

Error: Cannot read properties of undefined (reading 'uaa') #75

AelElliotBanyard opened this issue Oct 10, 2024 · 21 comments

Comments

@AelElliotBanyard
Copy link

I'm encountering an issue with the capjs/sdm package while saving a draft in development mode.

The following error is thrown:
Cannot read properties of undefined (reading 'uaa')

Steps to Reproduce:

Start the application on local device.
Try to save a draft.
Error pops up on screen.
Expected Behavior: The draft should save successfully without errors.

Actual Behavior: The error Cannot read properties of undefined (reading 'uaa') is thrown, preventing the draft from being saved.

Environment:

capjs/sdm version: 1.2.0
Development mode
Node.js version: ^18
Other relevant dependencies or configurations: @sap/cds-dk: 7.9.2
Additional Information: This error only appears to happen in development mode.
I'm happy to provide further information if needed to help troubleshoot the issue.

@rashmiangadi11
Copy link
Contributor

HiAelElliotBanyard,
I think you are running this application locally, if it is so than you need to configure approuter which can generate the JWT token and use it for token exchange.
Kindly refer this blog to set up approuter and run your application locally

https://community.sap.com/t5/technology-blogs-by-members/test-your-cap-nodejs-applications-with-authentication-locally/ba-p/13417243

Regards,
Rashmi

@AelElliotBanyard
Copy link
Author

Hi @rashmiangadi11,
Thank you for your reccomendation. The implementation of the approuter did not fix the issue.
Kind Regards
Ael

@rashmiangadi11
Copy link
Contributor

Can we have a call tomorrow. Could u please schedule a meeting

@AelElliotBanyard
Copy link
Author

Do you mean me?

@rashmiangadi11
Copy link
Contributor

Yes otherwise could you please send your email address and preferred time slot to schedule a meeting

@AelElliotBanyard
Copy link
Author

AelElliotBanyard commented Oct 15, 2024

You can contact me at [email protected] . I am available from 10 am until 12 pm and from 1 pm until 4 pm GMT+2. Kind Regards

@rashmiangadi11
Copy link
Contributor

Could you please tell me the timezone of yours to schedule a meeting.

@ashishjain14
Copy link
Member

Hi @AelElliotBanyard : Ideal setup would be to deploy your application on BTP and then run it against a provisioned Document Management Integration option instance. Have you tried testing the application using the step as suggested in the README?

@AelElliotBanyard
Copy link
Author

Hi @ashishjain14 yes. the application is deployed to BTP and works fine there but the problem is I cannot test implemented features locally and this makes the development process very long.

@AelElliotBanyard
Copy link
Author

@rashmiangadi11 Timezone is in the comment but I am in CEST.

@ashishjain14
Copy link
Member

@AelElliotBanyard : Can you share more details on the issue you are facing with your local development?

@AelElliotBanyard
Copy link
Author

AelElliotBanyard commented Oct 16, 2024

@ashishjain14: I have an Entity which is using attachments. This Entity has odata draft enabled. When creating an Object and hitting save i get the error message mentioned in the title of issue. Because of the BTP that we are using we have implemented the fix with the versioned repository.

@AelElliotBanyard
Copy link
Author

@ashishjain14 Any Updates?

@ashishjain14
Copy link
Member

@ashishjain14: I have an Entity which is using attachments. This Entity has odata draft enabled. When creating an Object and hitting save i get the error message mentioned in the title of issue. Because of the BTP that we are using we have implemented the fix with the versioned repository.

So If I understand correctly you are using a custom version of library where you have added a custom fix to support versioned repo?

@AelElliotBanyard
Copy link
Author

AelElliotBanyard commented Oct 17, 2024

@ashishjain14: I have an Entity which is using attachments. This Entity has odata draft enabled. When creating an Object and hitting save i get the error message mentioned in the title of issue. Because of the BTP that we are using we have implemented the fix with the versioned repository.

So If I understand correctly you are using a custom version of library where you have added a custom fix to support versioned repo?

no using the normal version with npm install ... and yes this is the fix:

 const sdmUtils = require("@cap-js/sdm/lib/util/index");

  // Override the isRepositoryVersioned function directly in the utility module
  sdmUtils.isRepositoryVersioned = function (...args) {
    console.error("override isRepositoryVersioned");
    return false;
  };

@ashishjain14
Copy link
Member

Do you still the same error with non-versioned repository and using the released version of our library?

@AelElliotBanyard
Copy link
Author

no the fix works

@ashishjain14
Copy link
Member

Hi @AelElliotBanyard : We are little lost into what is the actual problem here. Your initial point was local testing not working and now I see you have another problem where you are trying to override versioned repo check and running a deployment. Can you let us know what is the problem you are facing?

@AelElliotBanyard
Copy link
Author

there is no problem with the repo that works fine that is from issue #67 my boss comented on in this repo (@korayyersel). That is not the problem! the problem is with local development

@ashishjain14
Copy link
Member

Can you try this blog to run the app locally(https://community.sap.com/t5/technology-blogs-by-sap/run-node-js-applications-with-authentication-locally-sap-btp-security/ba-p/13540122) . In case this does not work I suggest you to create a service now ticket.

@AelElliotBanyard
Copy link
Author

I implemented the approuter but the local app still wants me to sign in this way:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants