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

Cds unable to find service implementation #98

Open
bartdeboer opened this issue Oct 27, 2020 · 0 comments
Open

Cds unable to find service implementation #98

bartdeboer opened this issue Oct 27, 2020 · 0 comments

Comments

@bartdeboer
Copy link

bartdeboer commented Oct 27, 2020

We have recently upgraded our application from cds 3 to cds 4.2.7. When running cds run in the project root folder everything runs perfectly. However when running cds run within the ./srv folder cds seems to be unable to find the service.js implementation. After some digging it looks like something goes wrong in @sap/cds/lib/srv/factory.js. Specifically the sibling function is resolving to the current path which results in an extra srv/ segment like srv/srv/.

const sibling = (d) => {
  const src = _source(d), home = path.resolve(src,'..')
  ...
}

It's unable to find the sibling Javascript implementation. This causes problems with our mta deployment setup (which will run cds run from within the srv/ folder).

Alternatively I tried setting the implementation through the impl annotation on the service.cds definition. But I can't seem to get it to work from both the root and srv/ path simultaneously.

Finally I tried to set the implementation through the kind annotation on the service.cds and specifying the implementation of that kind in .cdsrc.json. This caused an infinite loop:

@sap/cds/lib/srv/factory.js:

...
return _use (_required())

function _use (it) {
    ...
    if (typeof it === 'function') return _use (_required(), /*with:*/ o.impl = _function(it)) // NOSONAR
    ... 
}
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

1 participant