Packer startup_script_file on GCE not waiting for script to execute

Hello there,

Packer version is 1.8.6.

I am looking for a little clarification on the execution of startup scripts on GCE.
Currently I have a startup-script-file, and I can see that set in the metadata (startup-script).

during the execution, packer seeming does not wait for this script to finish (it should take around 5 mins).

Packer is waiting for the instance SSH to become available, then connects and immediately deletes the instance - not allowing the startup script to execute.

[2023-04-05 13:50:12] Step #1: ==> googlecompute: Using SSH communicator to connect: 34.173.174.66
[2023-04-05 13:50:12] Step #1: ==> googlecompute: Waiting for SSH to become available…
[2023-04-05 13:50:12] Step #1: ==> googlecompute: Connected to SSH!
[2023-04-05 13:50:12] Step #1: ==> googlecompute: Deleting instance…

Would someone be able to clarify if this should be waiting for that script to exit?

Some additional notes here as well.
I have tried the wrapper flag - and that results in a forever waiting for script to finish…
That wrapper seems to be broken - as it is waiting for a metadata field to be set to done - but that never happens.

It seems either path is not functional.

This startup wrapper was tested with 1.7.8 version of packer.

So I have found the error! Permissions… as usual.