platformatic / meraki

Wizard for stackables app
Apache License 2.0
30 stars 1 forks source link

Editing an application, the entrypoint in the form is not set correctly #721

Open marcopiraccini opened 5 months ago

marcopiraccini commented 5 months ago

It always sets the first one

tonysnowboardunderthebridge commented 5 months ago

HI @mcollina @marcopiraccini

I have added the following video. I created an app with 3 services:

Schermata 2024-05-23 alle 14 56 42

then I select terzo as entrypoint. As you can see terzo is the first selected service because is the entrypoint

Schermata 2024-05-23 alle 14 57 17

Here the PR to put this behavior (https://github.com/platformatic/meraki/pull/428). I personally agree with the PR from @leorossi, also @Fmusso94 reported that during tests on meraki.

However there is a bug instead on the update of the application. Changing the entrypoint is not considered (I found that the possible bug could be here https://github.com/platformatic/meraki/blob/main/src/main/generate.mjs#L158, I've already checked that the UI passed the new desired entrypoint name).

mcollina commented 5 months ago

Note that the entry point is not updated at all when updating an application

tonysnowboardunderthebridge commented 5 months ago

Note that the entry point is not updated at all when updating an application

Yep I noticed during tests today, I've already checked were the problem could be. is a problem to have the entrypoint as first service?

tonysnowboardunderthebridge commented 5 months ago

HI @mcollina @leorossi

the problem is on generator inside platformatic (https://github.com/platformatic/platformatic/blob/main/packages/runtime/lib/generator/runtime-generator.js#L335)

1) I tried to

this cause the following problem

Error: Error invoking remote method 'open-app': FastifyError [PLT_CONFIG_CANNOT_PARSE_CONFIG_FILE]: Cannot parse config file. Invalid entrypoint: 'terzo' does not exist

2) also setting a different entrypoint doesn't work https://github.com/platformatic/meraki/blob/main/src/main/generate.mjs#L158

(I tried to use the following code in the following )

if (!isUpdate) {
    // Creation
    generator.setEntryPoint(entrypoint)
    await generator.prepare()
    await generator.writeFiles()
  } else {
    await generator.loadFromDir()
    generator.setEntryPoint(entrypoint)
    generator.update({ services })
  }

But the application was not updated.

leorossi commented 5 months ago

It's a bug on the generator that does not support this feature.

I opened an issue: https://github.com/platformatic/platformatic/issues/2601 assigned to me