Skip to content

gp preview has no response when composer install is used #7825

@tmy2017

Description

@tmy2017

Bug description

When I use gp preview in .gitpod.yml command key - it has no response, vscode does not open preview.

As per my own investigation, composer install in before or command key is causing this issue.

Steps to reproduce

In .gitpod.yml for command key I have gp preview $(gp url 8765)/users/login, however, when workspace creates (or restarts) - the gp preview simply has no response - vscode does NOT open preview.

  • image

Even more strange is - when I open a new terminal - the same "no response" situation persists, gp preview simply does not do anything. However, if I refresh my Chrome tab, at the same terminal with the same command gp preview - then I can see it working correctly - will open a preview window in vscode.

In addition, after quite some trail-and-error - I now can pinpoint the composer install in my .gitpod.yml (full content below) is causing this issue. As long as I comment it out, or using composer install --quiet, then this problem is gone! (I have tried other stuffs with composer install like --no-interaction --no-scripts --ansi or 2>&1 >/dev/null - all to no avail - the problem will persist).

On the other hand, if I place composer install in the init key, this gp preview problem is gone as well!

Lastly, when workspace is started, I sometimes (not always) see the error message of "Unable to connect to VS Code server". However, even without that error message showing up, the gp preview is not working either.

  • image

Note: Yes I understand normally composer install is in the init key so we can enjoy the benefit of prebuild, but I am just really curious to understand how this problem could happen ;)

Workspace affected

https://azure-peacock-jf7bw4ivdc2.ws-eu29.gitpod.io/

Expected behavior

When using gp preview in .gitpod.yml or in the terminal - vscode should open preview accordingly

Example repository

snapshot

Anything else?

.gitpod.yaml content

image: tmy2017/gitpod-pstorm-with-php71-mysql8:ver-1640846949
tasks:
  - command: gp preview $(gp url 8765)/users/login
  - before: |
      sudo add-apt-repository ppa:ondrej/php -y && \
      sudo install-packages php7.2 php7.2-xdebug php7.2-mysql php7.2-intl php7.2-mbstring php7.2-curl php7.2-simplexml && \
      sudo update-alternatives --set php /usr/bin/php7.2
      php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
      php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
      sudo php composer-setup.php --install-dir /usr/bin --filename composer
      php -r "unlink('composer-setup.php');"    
      cp config/.gitpod.env config/.env
      cp config/.gitpod.app_local.php config/app_local.php
      composer install --no-interaction
    init: |
      mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';"
      mysql -e "create database cake_cms"
      mysql -D cake_cms < config/.gitpod.seed.sql
    command: |
      bin/cake server

github: 
  prebuilds:
    branches: true

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions