W
Wasp-lang•9mo ago
Jake

ngrok...

Thought would be cool to share the app with a colleague using ngrok. Its breaking because auth/me on 3001 XMLHttpRequest cannot load http://localhost:3001/auth/me due to access control checks. ngrok http http://localhost:3000 has anyone made it work? how did you make it work?
5 Replies
martinsos
martinsos•9mo ago
Hey, so I just gave it a try with
ngrok http 3000
ngrok http 3000
and it worked out of the box! Then I also tried
ngrok http http://localhost:3000
ngrok http http://localhost:3000
and that also worked. No issues with access control checks. I am on Linux, Wasp 0.12.3, ngrok 3.8.0 . What is your setup? One thing you can possibly try is giving it 127.0.0.1 instead of localhost, I noticed on some people's machines this works better. So ngrok http http://127.0.0.1:3000 . For me both work. App I tried this with is this one, so you can also try on it just to make sure it is not an issue on the app side: https://github.com/wasp-lang/wasp/tree/main/examples/thoughts .
GitHub
wasp/examples/thoughts at main · wasp-lang/wasp
The fastest way to develop full-stack web apps with React & Node.js. - wasp-lang/wasp
miho
miho•9mo ago
For me, it works if you open the ngrok link on your own computer 😄 It can't reach the server on localhost:3001 if you open it on my phone. I had to forward both the client and the server with:
ngrok http 3000
ngrok http 3000
and
ngrok http 3001
ngrok http 3001
And also set this in my .env.client the address of the forwarded local server:
REACT_APP_API_URL= https://0bc4-212-15-177-30.ngrok-free.app
REACT_APP_API_URL= https://0bc4-212-15-177-30.ngrok-free.app
martinsos
martinsos•9mo ago
ah crap yeah I opened it on my computer, didn't think much about it 😄
Jake
JakeOP•9mo ago
I got a bunch of errors... i am on a mac. ngrok http 3000 ngrok http 3001 -> this URL set to REACT_APP_API_URL access the URL got from 3000. Here are the errors I see in my browser console. [Error] WebSocket connection to 'wss://0dc1-76-93-181-125.ngrok-free.app/' failed: WebSocket is closed due to suspension. [Error] Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ["auth/me"] onSuccess (@tanstack_react-query.js:1020) resolve (@tanstack_react-query.js:603) 3001 server console: OPTIONS /auth/me 204 No Content OPTIONS /auth/me 204 No Content OPTIONS /auth/me 204 No Content OPTIONS /auth/me 204 No Content OPTIONS /auth/username/login 204 No Content POST /auth/username/login 200 OK <- this one when i directly went to url/login OPTIONS /auth/me 204 No Content OPTIONS /auth/me 204 No Content OPTIONS /auth/me 204 No Content
martinsos
martinsos•9mo ago
Do you potentially have a Wasp app that you could share with us, so we can replicate it? Or, what if you go for https://github.com/wasp-lang/wasp/tree/main/examples/thoughts, can you try running this one and see if it works? If this one also doesn't work for you, then we at least know the problem is not in the app itself, but in your setup vs ours.
Want results from more Discord servers?
Add your server