gravitee-io / issues

Gravitee.io - API Platform - Issues
64 stars 26 forks source link

Import API: new plans are created instead of updated (creating duplicates) #8414

Closed ctessier closed 1 year ago

ctessier commented 2 years ago

:collision: Describe the bug

Since I migrated from v3.9. to v3.10, when I import my APIs, new plans are created instead of the current ones being updated. I didn't change my import script. It performs a cURL PUT request on the management API /apis/{api.id}/import with a JSON definition provided. In my the JSON definitions (created a while ago from exports), I don't have ids. Only the following properties for the plans:

I checked the changelog and the upgrade guide but I couldn't find anything that could explain this new behaviour.

Any idea if this is a known bug which is fixed in a more recent version? I am trying to perform a step by step upgrade but I don't want to move on until I know what causes this.

:sunrise_over_mountains: To Reproduce

Steps to reproduce the behaviour:

  1. Have APIs and plans on Gravitee 3.9
  2. Upgrade to Gravitee 3.10
  3. Import the JSON definition with the /apis/{api.id}/import endpoint or through the UI
  4. See API is updated but new (duplicate) plans are created

:rainbow: Expected behaviour

Same as with v3.9. Making a PUT request of a JSON API definition on the /apis/{api.id}/import endpoint updates the API and its existing plans.

Current behaviour

Since v3.10.0, making a PUT request of a JSON API definition on the /apis/{api.id}/import endpoint updates the API but create new plans (generating duplicates).

:movie_camera: Useful information

I have tested on v3.10.0 and v3.11.1 where I can reproduce the issue. It happens also when using the export/import feature from the UI.

:computer: Desktop:

Please complete the following information:

:warning: Potential impacts

Which other features may be impacted by this fix. This could be populated after fix

What are the impacted versions?

v3.10.0 and above

:link: Dependencies

Link a story or other related things...

ctessier commented 2 years ago

What does Gravitee need in the JSON file to know it is the same API and the same plan ?

I tried adding the id property, but it still create new plans. From v3.10.8, the import tries to delete my existing plans but fails because it has subscriptions.

Why doesn't it detect that it is the same plan and it must simply be updated?

A little help would be much appreciated! Thank you :smiley:

mouligno commented 2 years ago

Hi @ctessier

We've experienced some plans duplications issue in 3.10.x that has been fixed now. I strongly suggest to upgrade to 3.18.x since we've been introducing crossId from 3.16 in order to identify easily apis, pages and plans accros several environments.

Let me know if you need further info