`gp preview` has no response when `composer install` is used
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.8k
- Forks
- 1.4k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 5
Description
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.
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.
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the report with the supplied .gitpod.yml, especially composer install in before or command, gp preview, and the bin/cake server task. Compare behavior when composer install is moved to init or run with --quiet, and check the reported VS Code server connection symptom. Done means gp preview opens the VS Code preview reliably from the task and a terminal without refreshing the browser.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, vscode
- Domain
- cli, cloud, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100

