Failed Gateway In Bitbucket Infrastructure?
Asked by ChristopherBrand:

I have a build that works locally that is failing in Bitbucket Pipelines due to a reported "Bad Gateway" I have tested manually retrieving the .deb from multiple VMs and my local device and it is working. This seems to be isolated to Bitbucket at the moment how do I proceed with fixing this so I can get my deployments back on track.

Here is the offending portion of the log file. All goes well until it tries to fetch the gcsfuse repo that works just fine everywhere else.

Get:1 <http://deb.debian.org/debian> bookworm/main amd64 libfuse2 amd64 2.9.9-6+b1 [119 kB]  
4009
Get:2 <http://deb.debian.org/debian> bookworm/main amd64 fuse amd64 2.9.9-6+b1 [61.3 kB]  
4010
Ign:3 <http://packages.cloud.google.com/apt> gcsfuse-bookworm/main amd64 gcsfuse amd64 1.2.0  
4011
Ign:3 <http://packages.cloud.google.com/apt> gcsfuse-bookworm/main amd64 gcsfuse amd64 1.2.0  
4012
Ign:3 <http://packages.cloud.google.com/apt> gcsfuse-bookworm/main amd64 gcsfuse amd64 1.2.0  
4013
Err:3 <http://packages.cloud.google.com/apt> gcsfuse-bookworm/main amd64 gcsfuse amd64 1.2.0  
4014
502 Bad Gateway [IP: 142.251.16.101 80]  
4015
Fetched 180 kB in 7s (24.1 kB/s)  
4016
E: Failed to fetch <http://packages.cloud.google.com/apt/pool/gcsfuse-bookworm/gcsfuse_1.2.0_amd64_0e91d38c68c91349633d37c17e1586e6.deb> 502 Bad Gateway [IP: 142.251.16.101 80]  
4017
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?  
4018
The command '/bin/sh -c chmod 755 /entrypoint.sh; set -eux; apt-get update; apt-get install -y --no-install-recommends libzip4 imagemagick ghostscript ffmpeg; rm -rf /var/lib/apt/lists/* ; rm -Rf /var/www/html; set -ex; savedAptMark="$(apt-mark showmanual)"; apt-get update; apt-get install -y --no-install-recommends libfreetype6-dev libicu-dev libjpeg-dev libmagickwand-dev libpng-dev libwebp-dev lsb-release gnupg2 libzip-dev; pecl install redis; docker-php-ext-enable redis; docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; docker-php-ext-install -j "$(nproc)" bcmath exif gd intl mysqli zip; pecl install imagick-3.6.0; docker-php-ext-enable imagick; rm -r /tmp/pear; out="$(php -r 'exit(0);')"; [ -z "$out" ]; err="$(php -r 'exit(0);' 3>&1 1>&2 2>&3)"; [ -z "$err" ]; extDir="$(php -r 'echo ini_get("extension_dir");')"; [ -d "$extDir" ]; apt-mark auto '.*' > /dev/null; apt-mark manual $savedAptMark; ldd "$extDir"/*.so | awk '/=>/ { print $3 }' | sort -u | xargs -r dpkg-query -S | cut -d: -f1 | sort -u | xargs -rt apt-mark manual; export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`; echo "deb <http://packages.cloud.google.com/apt> $GCSFUSE_REPO main" | tee /etc/apt/sources.list.d/gcsfuse.list; curl <https://packages.cloud.google.com/apt/doc/apt-key.gpg> | apt-key add -; apt update; if [ "dev" != "$ENV" ] ; then apt install -y --no-install-recommends gcsfuse; fi; apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; rm -rf /var/lib/apt/lists/*; ! { ldd "$extDir"/*.so | grep 'not found'; }; err="$(php --version 3>&1 1>&2 2>&3)"; [ -z "$err" ]' returned a non-zero code: 100  
4019
2023-10-09T18:01:42.212261956Z stdout P  
4020  
4021


Answers:
author: Theodora Boudale
body: Hi Christopher,

What command is giving you this error?

Are you using a public Docker image as a build container for this step, and if so, which one?

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud