question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proxying of port does not work for React Native (Expo) apps

See original GitHub issue

I have read gone through many docs of code-server about the proxying of port. The syntax for that is https://address-of-code-server/proxy/19002

But in the case of metro apps, it does not work. Let me attach a screenshot for better reference. Any help in this case would be pretty helpful. FYI: I know I can expose the ports like 19002 that expo uses, but that would not be the end solution, hence I want to go forward with proxying. (Also, to expose a port on my docker container, would require rebuilding it and it would take a time and effort for me atleast.) Tagging few whom I know helpful in this organisation, @jsjoeio @bpmct @code-asher

[SCREENSHOT OF INITIALISING A BLANK REACT NATIVE PROJECT] image

[SCREENSHOT OF THE EXPO APP BEEN BUILT AND EXPOSING THE DEV TOOLS ON http://localhost:19002 ] image

[SCREENSHOT OF EXPO DEV TOOLS ON BROWSER VIA code-server PROXY] image Here, it seems like, the page title image is being loaded as it is evident, but somehow the page content is not being served, Things might be related to Next.js as expo uses Next.js to serve the dev tools in the browser.

[SCREENSHOT OF THE NETWORK TAB LOADING THE FILES FROM THE DEV SERVER] image

Any help would be very helpful, thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hesa2020commented, Feb 23, 2022

I was also having a similar issue,

I created a webpack.config.js file with following content:

// Expo CLI will await this method so you can optionally return a promise.
module.exports = async function(env, argv)
{
	const config = await createExpoWebpackConfigAsync(env, argv);
	if (config.mode === 'development')
	{
		config.output.publicPath = "https://code.mydomain.com/proxy/19006/";
	}
	return config;
};

Then after that it started working, You might get some “watchers limit reached” if you are running a ubuntu docker image like me but this was easy to fix with a few commands to raise the limit.

1reaction
code-ashercommented, Jun 9, 2021

I think that makes sense since Expo sees /absproxy/19002 and that path doesn’t exist.

From here we would need to configure Expo to understand that /absproxy/19002 is the base path but they don’t seem to have any documentation on how to do that.

It looks like it uses Webpack so I tried to set the public path but I didn’t have any luck. I found an upstream issue about it though; it seems they hardcode /: https://github.com/expo/expo-cli/issues/3092

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting proxies - Expo Documentation
Learn about troubleshooting proxies with a set of recommended tools. ... Automatic Proxy Configuration your-corporate-proxy-uri:port-number/proxy.pac .
Read more >
Can't load expo app: Something went wrong - Stack Overflow
This problem is caused by QR code which directs your phone to the 127.0.0.1, which is localhost and therefore can not access computer...
Read more >
Debugging with Expo - tries to connect to wrong packager port
I now run into the problem that the React Native Debugger seems to occupy the debug port, so VSC won't attach: Established a...
Read more >
React Native Expo on WSL2 - Medium
However, since these ports were being used within the WSL2 environment, the Expo app could not connect (since WSL2 does not operate on...
Read more >
Running On Device - React Native
Method 2: Connect via Wi-Fi​ · Make sure your laptop and your phone are on the same Wi-Fi network. · Open your React...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found