IBM Support

Publishing API fails with 409 error

Troubleshooting


Problem

Publishing API fails with 409 error

Cause

In the apim pod logs, you will notice, a similar detailed error :
  <date_time> bhendi:error [Txn_id] lib/db::execute failed, Code='23505', Message='duplicate key value violates unique constraint "api_lower_namespace_lower1_idx"': duplicate key value violates unique constraint "api_lower_namespace_lower1_idx", stack: error: duplicate key value violates unique constraint "api_lower_namespace_lower1_idx"
      at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)
      at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
      at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
      at TLSSocket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)
      at TLSSocket.emit (node:events:513:28)
      at addChunk (node:internal/streams/readable:324:12)
      at readableAddChunk (node:internal/streams/readable:297:9)
      at Readable.push (node:internal/streams/readable:234:10)
      at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)
  <date_time> bhendi:error [Txn_id] statement: INSERT INTO api(api,catalog_api,gateway_service_urls,type,api_version,id,namespace,version,name,title,scope,state,created_at,updated_at,url,org_url,catalog_url,user_registry_urls,oauth_provider_urls,tls_client_profile_urls,extension_urls,policy_urls,api_type,gateway_type,oai_version,base_paths,document_specification,enforced,gateway_api,consumer_api) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30)
  <date_time> bhendi:error [Txn_id] lib/db::execute throwing 409 due to constraint violation (see reason code/message above)
When publishing a product/API to a catalog we check if the API already exists, if it already exists and production mode is false we update the API but what happens here is when we do the GET call for the API "Xyz" no API is returned. So we try to create the API and the database blocks it with the 409.

If we only have 1 product referencing the API "xyz" we delete the product which deletes that API, so thats why the republish is successful, but since you have another product referencing that API its not deleted.

Resolving The Problem

You need to keep the name of the API as it is or update the name in the draft API to match what is already published to the catalog or you will need to retire the API and publish again or publish a new version.

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB67","label":"IT Automation \u0026 App Modernization"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSMNED","label":"IBM API Connect"},"ARM Category":[{"code":"a8m0z000000Gn1OAAS","label":"API Connect-\u003EDeveloper (DV)-\u003EPublish"}],"ARM Case Number":"TS015378975","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"10.0.5"}]

Document Information

Modified date:
19 February 2024

UID

ibm17120838