Ultraviolet icon indicating copy to clipboard operation
Ultraviolet copied to clipboard

TypeError while running on Google Cloud Shell

Open tuta-amb opened this issue 1 year ago • 10 comments

I'm running this app on Google Cloud Shell Preview, and before you recommend another platform:

  1. Every single app host is blocked, only reason Google Cloud Shell isn't is because all Google domains have a hard coded whitelist.
  2. Shell Preview gives 50 hours a week of free usage
  3. My school trusts any google.com domain

However when deploying any Ultraviolet-based proxy, namely github.com/titaniumnetwork-dev/Ultraviolet-App and Holy Unblocker, I get the following error:

Error processing your request
Failed to load https://www.google.com/search?q=test
Internal Server Error
Code:	TypeError
TypeError: Failed to fetch

image Also, when deploying a simple TompHTTP bare server from NodeJs, I get the following 401 error:

RangeError: Failed to construct 'Response': The status provided (0) is outside the range [200, 599].

Issue #78 seems to have a identical problem. This is probably related to #77 and tomphttp/bare-server-node/issues/17. On the TompHTTP issue thread, it discusses setting the port visibility to public, and I may have read somewhere about Google Cloud Shell Preview requiring account authentication to access the preview, so that could be the problem, although I am not sure.

To reproduce:

  1. Launch Google Cloud Shell
  2. $ git clone https://github.com/titaniumnetwork-dev/Ultraviolet-App.git
  3. $ cd Ultraviolet-App
  4. $ npm install
  5. $ npm start
  6. Open web preview
  7. Go to any website

tuta-amb avatar Oct 17 '23 01:10 tuta-amb

This is because of how previews work on Google cloud shell, you'd have to modify UV to make this work

ProgrammerIn-wonderland avatar Oct 24 '23 21:10 ProgrammerIn-wonderland

Cut it out, both of you @Jokypond @ilikemen132

ProgrammerIn-wonderland avatar Oct 24 '23 22:10 ProgrammerIn-wonderland

Cut it out, both of you @Jokypond @ilikemen132

so sorry

ghost avatar Oct 24 '23 23:10 ghost

@ProgrammerIn-wonderland Thanks, I suspected so, but I'm not familiar with Ultraviolet internals, so if you could guide me in the right direction, I would be happy to make this on my own and submit a PR.

tuta-amb avatar Oct 25 '23 11:10 tuta-amb

I'm honestly not sure where to start, it would also require understanding how Google cloud auth works, but you can give it a shot

ProgrammerIn-wonderland avatar Oct 25 '23 16:10 ProgrammerIn-wonderland

Alright, @ProgrammerIn-wonderland I'll give it a try. I'm assuming that becuase Google Cloud Shell Preview requires authentication, the service worker that proxies requests doesn't get the requests sent.

tuta-amb avatar Oct 25 '23 17:10 tuta-amb

I have been installing Ultraviolet on Deta Space. The same problem encountered. I solved it by setting public: true, which I guess is basically the same as Gitpod's set the port visibility to public. So I guess this happens because Ultraviolet's request to the bare server is blocked by authentication? update:

the service worker that proxies requests doesn't get the requests sent.

This is reasonable too. But I don't know internal of how Ultraviolet talks to bare server, or how service workers work.

xjzh123 avatar Nov 01 '23 12:11 xjzh123

Yeah pretty sure it has to do with a firewall issue

proudparrot2 avatar Nov 02 '23 02:11 proudparrot2

@xjzh123

So I guess this happens because Ultraviolet's request to the bare server is blocked by authentication?

Definitely. This official Google article confirms it: Cloud Shell - Preview web apps I think this could be achieved if I found the authentication headers that are necessary to make requests to the preview backend, and sent them along in the service worker proxy.

Also: How are you running on Deta Space? Just curious. Is there an app from the marketplace available or do I need to create my own app? (Which is possible, since my dev mode request did get accepted)

tuta-amb avatar Nov 02 '23 20:11 tuta-amb

@xjzh123

So I guess this happens because Ultraviolet's request to the bare server is blocked by authentication?

Definitely. This official Google article confirms it: Cloud Shell - Preview web apps I think this could be achieved if I found the authentication headers that are necessary to make requests to the preview backend, and sent them along in the service worker proxy.

Also: How are you running on Deta Space? Just curious. Is there an app from the marketplace available or do I need to create my own app? (Which is possible, since my dev mode request did get accepted)

I have created UltraViolet-App and Cobalt in the marketplace, so everyone can install them on deta.

xjzh123 avatar Nov 20 '23 10:11 xjzh123

Closed as stale

rifting avatar May 03 '24 01:05 rifting