facebook / flipper

A desktop debugging platform for mobile developers.
https://fbflipper.com/
MIT License
13.32k stars 954 forks source link

Listening for react native bundler on a different port #1509

Open anirudhagarwal365 opened 4 years ago

anirudhagarwal365 commented 4 years ago

I was trying to integrate react native Android application with Flipper. I don't see React Native device on Flipper desktop application. I am suspecting this is happening because my metro bundler runs on custom port 8082. How do I configure Flipper to listen on my custom port.

I tried reading up on https://fbflipper.com/docs/custom-ports, but need help understanding INSECURE_PORT & SECURE_PORT.

nikoant commented 4 years ago

Hi @anirudhagarwal365, the doc you mentioned describes ports for communication between Flipper desktop app and devices. Metro bundler port is currently hardcoded to 8081. I think the easiest solution to fix this is to change this code a bit to make it possible to specify port by env var, e.g. FLIPPER_METRO_PORT.

anirudhagarwal365 commented 4 years ago

Hi @nikoant. Thanks for pointing it out. Was able to run successfully by creating a fork of the project and making the required changes. Now I am able to see the react native device. (Might create a PR later if I get time)

However, I am not getting "Hermes Debugger Error" - "Metro disconnected. Please check that metro is running and Flipper can connect to it." on the Hermes debugger tab. Logs and React DevTools seem to be working as expected.

I have already verified that global.HermesInternal !== null, return true.

mweststrate commented 4 years ago

Looks like that should be using the env var: https://github.com/facebook/flipper/blob/master/desktop/plugins/hermesdebuggerrn/index.tsx#L26

On Wed, Sep 2, 2020 at 7:40 PM anirudhagarwal365 notifications@github.com wrote:

Hi @nikoant https://github.com/nikoant. Thanks for pointing it out. Was able to run successfully by creating a fork of the project and making the required changes. Now I am able to see the react native device. (Might create a PR later if I get time)

However, I am not getting "Hermes Debugger Error" - "Metro disconnected. Please check that metro is running and Flipper can connect to it." on the Hermes debugger tab. Logs and React DevTools seem to be working as expected.

I have already verified that global.HermesInternal !== null, return true.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/facebook/flipper/issues/1509#issuecomment-685925021, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN4NBFEKNS3IGHJPK6ROD3SD2GRHANCNFSM4QRMZWRQ .

anirudhagarwal365 commented 4 years ago

Thanks @mweststrate. That solves this issue.

Somehow stuck with "Metro is connected but no Hermes apps were found".

I tried "http://localhost:8082/json" (8082, since metro server runs on that port), but it returns []. Could this be the issue?

nikoant commented 4 years ago

@anirudhagarwal365 do you mind to open PR with your changes?

anirudhagarwal365 commented 4 years ago

Hi @nikoant . Still not able to successfully run hermes debugger. Still stuck on "Metro is connected but no Hermes apps were found". Not sure if I have accounted for all the changes.

anirudhagarwal365 commented 4 years ago

Hi @nikoant Can you help here or tag someone who might be able to?

nikoant commented 4 years ago

I think "Metro is connected but no Hermes apps were found" is a different problem. Please check this thread for possible solutions: https://github.com/facebook/flipper/issues/1000.

nikoant commented 4 years ago

If still troubled, please provide additional details for further investigation: 1) are you using physical device or emulator? 2) is your app configured to use Hermes VM? 3) What OS are you on? MacOS/ Windows / Linux? 4) please provide a repo with minimal reproducible example of RN app you are trying to debug.

http://localhost:8082/json should definitely return something if your app is running on device and properly configured.

stale[bot] commented 3 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

stale[bot] commented 2 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.