mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #3739] [bug]: GraphQL request failing on opening the app - BASE_URL is being used instead of BACKEND_GQL_URL #1297
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#1297
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @skrypt-nl on GitHub (Jan 10, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3739
Is there an existing issue for this?
Current behavior
I'm running Hoppscotch on my own server using Docker compose.
The application can be accessed at the following domains (actual domain redacted):
The .env file has been modified to look like this:
I'm using NGINX proxies to redirect the (sub)domains to the right docker applications. I had to change the ports in the docker-compose file, but that all seems to be working fine. This is the edited config for the admin subdomain, for example:
Now, here comes the problem:
When I log in with my account for the very first time, everything works fine. I can create a team, change settings, change my profile, etc. The newly created team will show up in the teams dropdown, settings will be saved, and everything works fine.
However, as soon as I do a normal refresh (CMD+R, so without clearing the cache) on the page, the application will try to make a POST request for the
Me{}GraphQL query, on the following URL:sandbox.domain.com/graphql.This request will fail because the
/graphqlendpoint lives at theapi.sandbox.domain.comdomain, and I cannot see my teams, nor do anything related to my account.I figured out that when I do a hard refresh (CMD+SHIFT+R, which clears the cache), everything will work fine again. I can perform all the actions described above, and all GraphQL requests are being sent to the correct subdomain. But as soon as I do the next normal refresh, or open the application in another tab, well, then the problem is back.
One thing that might be good to know, I that my
VITE_BACKEND_GQL_URLused to be the wrong domain after I installed everything, as I was still figuring my way around the NGINX proxy and the different ports. As soon as I solved this, I changed the .env file and restarted the Docker services. Something tells me that there's probably something cache-related that's messing things up, but I cannot find what exactly.Steps to reproduce
Environment
Production
Version
Self-hosted
@skrypt-nl commented on GitHub (Jan 10, 2024):
So I managed to fix the issue, but I didn't find the exact source:
I manually deleted everything under the storage tab of my browser. My idea is that, somewhere, the app caches the GQL endpoint in the LocalStorage when the app is opened for the first time. When the endpoint then changes, on the server, the app doesn't flush the original endpoint from the LocalStorage, meaning it'll hit a 405 error every time the app opens after that.
@balub commented on GitHub (Jan 11, 2024):
The Hoppscotch app has service workers so it will cache the config, That is why a hard reset in the browser solves the problem.