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

Adding support for multi-tenancy #117

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Adding support for multi-tenancy #117

wants to merge 2 commits into from

Conversation

danjoa
Copy link
Contributor

@danjoa danjoa commented Dec 21, 2024

→ should discuss that in Jan

@sidakphull sidakphull requested review from RamIndia and jeevitha011 and removed request for sidakphull, muskansethi1 and SoujitD-SAP December 22, 2024 10:06
const meta = csn.meta ??= {}
if (!("Attachments" in csn.definitions)) return
if (meta._enhanced_for_attachments) return
// const csnCopy = structuredClone(csn) // REVISIT: Why did we add this cloning?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done because when we convert csn to LinkedCSN (next line) the @source property is deleted from the definitions of kind service in the csn. This was leading to deployment failures in production with the below error when files were present inside a folder in srv and not directly in srv.

Error: Failed loading service implementation from '/home/vcap/app/srv/<file-name>.js'

See cap/issues#16004 (cannot link it here) for more details.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sidakphull → will fix the root cause instead of having to go such workarounds.

Copy link
Contributor Author

@danjoa danjoa Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sidakphull, as you already pointed out, the issues might be due to @source being set by default.

As I was not able to reproduce the erroneous behaviour, though, may I ask you to do so with this line changed like that, in you local node_modules/@sap/cds/lib/srv/factory.js:

-- const _source = (d) => d['@source'] || (d['@source'] = d.$location && d.$location.file.replace(/\\/g, '/') || '.')
++ const _source = (d) => d['@source'] || d.$location?.file || '.'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not able to reproduce locally since I don't have the sample application from the issue anymore and it seems to be deleted. Will try again and get back to you regarding this.

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

Successfully merging this pull request may close these issues.

2 participants