cancel
Showing results for 
Search instead for 
Did you mean: 

cds deploy fails with "service instance already exists" message

pepl
Active Participant
0 Kudos

Hi!

I try to deploy my CAP project using cds deploy command. Here is my log:

cds deploy --to hana
Debugger attached.
[cds.deploy] - Starting deploy to SAP HANA ...

[cds.deploy] - Creating build tasks
[cds.deploy] - Running build

[cds.deploy] - Using container payops_api-db-hdi-container

[cds.deploy] - Running 'cf create-service hana hdi-shared payops_api-db-hdi-container' with options {}

Creating service "payops_api-db-hdi-container"...
FAILED: Asynchronous job 'Creating service instance 'payops_api-db-hdi-container' [service: 'hana', plan:'hdi-shared'] of [Org 'booking', Space 'DEV'].' failed: service instance 'payops_api-db-hdi-container' [service: 'hana', plan:'hdi-shared'] of [Org 'booking', Space 'DEV'] with same name already exists.
[ERROR] [cds.deploy] - Create request failed
From what I see :we have a method _getOrCreateCFService like this:

however there is no fallback scenario so it's not really true that it tries to get or create - it always tries to create and if it already exists - just fails.

Could you please have a look? I'm just following this guide actually https://cap.cloud.sap/docs/guides/databases#cds-deploy-hana

Thank you!

seVladimirs
Active Contributor
0 Kudos

Weird, for me it works. If a service is created then it simple re-use it.

Can you please share your CDS version by running `cds -v` command?

pepl
Active Participant
0 Kudos

30fb700ba8324cf6a2790bae5ac6e7b5, it's following:

cds -v
@sap/cds: 5.7.3
@sap/cds-compiler: 2.10.4
@sap/cds-dk: 4.7.2
@sap/cds-foss: 3.0.0
@sap/hana-client: 2.10.20
Node.js: v14.18.2
home: /workspace/node_modules/@sap/cds

It's important to mention that i have not cf but xs CLI aliased to cf:

cf version

Client version: xs v1.0.131

Server version information:
   name                    = XS Controller
   support                 = http://service.sap.com/message
   build                   = v1.0.130
   version                 = 1
   software version        = 1.0.130.519
   core version            = 1.0.130.519
   content version         = 1.0.130.519
   overall state           = READY
   user                    = <not set>
   description             = SAP HANA XS Advanced Runtime   
   loggingEndpoint         = <not set>
   allowDebug              = true
   acceptEncoding          = gzip, x-gzip
   limits                  = memory: <not set>, apps: <not set>, app uris: <not set>, services: <not set>
   usage                   = memory: <not set>, apps: 265, app uris: 200, services: 637
   databaseType            = HANA_MULTI
   databaseInfo            = HDB 2.00.056.00.1624618329

I understand that is not a really supported combination but the issue here is on Nodejs side - somehow it tries to call not a right CLI method.

Accepted Solutions (0)

Answers (2)

Answers (2)

pepl
Active Participant
0 Kudos

It works if we do like this:

What is important - in case of xs command line, stderr needs to be analyzied, not stdout.

pepl
Active Participant
0 Kudos

I know why. Here is the issue. If command fails - it throws an exception. I think what can help is to put 'already exists' condition in front of a generic fallback scenario. Do you know who can do this? Thanks!