502 Bad Gateway Error on Custom Shopify App Built with Remix and Hosted on GCP

I’m encountering a 502 Bad Gateway error when trying to open our custom app in the Shopify store. The app is built using Remix and is hosted on Google Cloud Platform (GCP). Here are the steps we have taken so far:

We restarted the Compute Engine instance on GCP.
We also restarted the Nginx server.

However, the error persists. Below are some additional details:

The Nginx configuration file (/etc/nginx/nginx.conf) seems standard, and includes configurations from /etc/nginx/conf.d/.conf and /etc/nginx/sites-enabled/.
The application is supposed to run on port 8080.

Here is a snippet from our Nginx error log:

2024/07/19 15:18:24 [error] 12503#12503: *47 no live upstreams while connecting to upstream, client: 103.251.255.124, server: app.agencyai.app, request: “GET /?embedded=1&hmac=23b9e76fb39ddf329dfd7d76f4cdd13331aeb5311a0979ed4a2f3edd0ec5d8ae&host=YWRtaW4uc2hvcGlmeS5jb20vc3RvcmUvaW1wZXJpYWwtZGF0YS1zdXBwbHk&id_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczpcL1wvaW1wZXJpYWwtZGF0YS1zdXBwbHkubXlzaG9waWZ5LmNvbVwvYWRtaW4iLCJkZXN0IjoiaHR0cHM6XC9cL2ltcGVyaWFsLWRhdGEtc3VwcGx5Lm15c2hvcGlmeS5jb20iLCJhdWQiOiIyOWFiODgwMDQwMzg1NWVjOTllMzAxYmRmMzRkNDc4ZSIsInN1YiI6Ijg4NDU0MzY1MzYzIiwiZXhwIjoxNzIxNDAyMzYzLCJuYmYiOjE3MjE0MDIzMDMsImlhdCI6MTcyMTQwMjMwMywianRpIjoiY2E3ZGYxMjItNmE3YS00NTY2LWE4NTUtMjc3MzAxYThmMDYxIiwic2lkIjoiYzAzYThkNmUtZWU3Ni00ZmViLTg5ZWQtN2YxYTdlZDdhNWNkIiwic2lnIjoiMTdjNmQ4MDZjZmI0ZDdiNGYzMmQwMzI2NmZiYjcwYWVkZjQ1NWEwNTE2ODQwY2VhYTU0YWE1ODJiZWVlMTA2OCJ9.A5Q0JJossokUhjNeafaXr_bD1tDKw7FCZAwpvlyHUq4&locale=en-CA&session=1d943e75b72dd40b3c2482d1bf17490788bf3818abba28d4da16bc3fd45f4185&shop=imperial-data-supply.myshopify.com&timestamp=1721402303 HTTP/1.1”, upstream: “http://localhost/?embedded=1&hmac=23b9e76fb39ddf329dfd7d76f4cdd13331aeb5311a0979ed4a2f3edd0ec5d8ae&host=YWRtaW4uc2hvcGlmeS5jb20vc3RvcmUvaW1wZXJpYWwtZGF0YS1zdXBwbHk&id_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczpcL1wvaW1wZXJpYWwtZGF0YS1zdXBwbHkubXlzaG9waWZ5LmNvbVwvYWRtaW4iLCJkZXN0IjoiaHR0cHM6XC9cL2ltcGVyaWFsLWRhdGEtc3VwcGx5Lm15c2hvcGlmeS5jb20iLCJhdWQiOiIyOWFiODgwMDQwMzg1NWVjOTllMzAxYmRmMzRkNDc4ZSIsInN1YiI6Ijg4NDU0MzY1MzYzIiwiZXhwIjoxNzIxNDAyMzYzLCJuYmYiOjE3MjE0MDIzMDMsImlhdCI6MTcyMTQwMjMwMywianRpIjoiY2E3ZGYxMjItNmE3YS00NTY2LWE4NTUtMjc3MzAxYThmMDYxIiwic2lkIjoiYzAzYThkNmUtZWU3Ni00ZmViLTg5ZWQtN2YxYTdlZDdhNWNkIiwic2lnIjoiMTdjNmQ4MDZjZmI0ZDdiNGYzMmQwMzI2NmZiYjcwYWVkZjQ1NWEwNTE2ODQwY2VhYTU0YWE1ODJiZWVlMTA2OCJ9.A5Q0JJossokUhjNeafaXr_bD1tDKw7FCZAwpvlyHUq4&locale=en-CA&session=1d943e75b72dd40b3c2482d1bf17490788bf3818abba28d4da16bc3fd45f4185&shop=imperial-data-supply.myshopify.com&timestamp=1721402303”, host: “app.agencyai.app”, referrer: “”

The nginx.conf file includes:

server {
listen 80;

server_name app.agencyai.app;

location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

}

We have verified that the application is supposed to be running on port 8080. Here are the additional troubleshooting steps we have taken:

Ensured the application server is running and listening on port 8080.
Checked firewall and security group rules to ensure port 8080 is open.
Verified the Nginx configuration and tested it with nginx -t.
Despite these steps, the issue persists. Any insights or suggestions on resolving this issue would be greatly appreciated.

Thank you!

What We Tried

Restarted the Compute Engine instance on GCP.
Restarted the Nginx server using the following commands:

sudo systemctl restart nginx

Verified that the application is supposed to run on port 8080.

Checked if the application server is running and listening on port 8080:

sudo netstat -tuln | grep 8080

We expected to see the application listening on port 8080, but it wasn’t.
Verified firewall and security group rules to ensure port 8080 is open.

Tested Nginx configuration to ensure there are no syntax errors:

sudo nginx -t

Monitored Nginx error logs to identify the issue.

What We Expected

We expected the custom Shopify app to load successfully without the 502 Bad Gateway error after restarting the services and verifying the configurations. We expected the application to be accessible through Nginx, indicating that it is correctly proxied to the backend application server running on port 8080.

Issue

Despite the above steps, the error persists, and the application remains inaccessible. The logs indicate a failure to connect to the upstream server, suggesting that either the application server is not running, not listening on the correct port, or there’s a misconfiguration in the Nginx setup.

Any insights or suggestions on resolving this issue would be greatly appreciated.

New contributor

Muscled PM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật