#Server Fn's not running

1 messages · Page 1 of 1 (latest)

thorny sinew
#

Hello! I am trying to call a server function in my fullstack desktop app (0.6 alpha 2 , cli and lib) but it just isnt being called:
I put a log info above and below the await call which both print but the server function (which has the print in it which i tried logging and println) never prints so its always coming back as Err and never Ok without even calling the server function

#

I updated my component to this to prove it prints the CLICK and AFTER methods on the button press:

#

It seems the server itself is not starting, i am running dx serve in my UI directory though which seems to be running the server and desktop fine

tough dragon
#

Can you print the error

thorny sinew
#

I do get this though when I press o to open server mode, it opens localhost:8080 though which isnt the addr I set but that displays this:

nimble patrol
tough dragon
thorny sinew
#

searching source, cant find anything in dioxus soruce

tough dragon
#

The server function crate lives in the leptos repo

#

I haven't seen that error before

thorny sinew
#

Nothing coming up in search sadly, would be nice if it was a little more descriptive 😭

thorny sinew
# thorny sinew

maybe tied to this? Seems its still trying to bind to localhost:8080 though i set it to something else with my own axum router

tough dragon
#

Oh, if you set up your own custom router did you update the url your desktop app is calling server functions on?

#

The CLI server shouldn't interact with desktop outside of hot reloading

thorny sinew
#

Aw shoot is that why

#

Cuz the fullstack-auth example didnt have it cuz they set up their own router so i didnt think you needed it

#

but i guess desktop you do? (i know that 1 liner youre talking about)

#

dioxus::fullstack::prelude::server_fn::client::set_server_url("http://127.0.0.1:8080");

tough dragon
#

Yeah, you don't need it on web becuase it is the current url

thorny sinew
#

i almost hope this doesnt work cuz of how much time i spent trying to figurethis out 😭 🤣 shadoslow

#

Okay so it didnt work!

#

wth 🤣 , same builder error, same error on :8080 too

thorny sinew
#

Definitely an issue with the server macro, removing alllows it to be called of course but that isnt a solution

tough dragon
#

I'm not sure what the issue is without more context...

#

Is the project open source?

thorny sinew
#

Yeah lemme push it up!

#

The backend folder doesnt matter that is old actix work

tough dragon
#

dioxus::fullstack::prelude::server_fn::client::set_server_url("http://{ip}:{port}");

#

That string is not formatted. In rust strings are only formatted if they are in the format macro. (RSX applies the format macro to strings automatically)

#

You need dioxus::fullstack::prelude::server_fn::client::set_server_url(format!("http://{ip}:{port}"));

thorny sinew
#

im actually stupid 😭

#

yeah i know rust well.... obviously i suck at remembering tho

#

i think i missed that cuz my editor grays out the featured out stuff that isnt enabled so i didnt have my colors 😭

#

Interesting though this function takes in a &'static str

#

thats extremely restrictive and wouldnt work in my case

tough dragon
#

I'm not sure why it takes &'static str. Could be worth an issue on the server_fn crate

#

Leaking the string in the meantime should be fine - you only launch your server once

thorny sinew
#

would have to be a build.rs variable or something that builds the string etc

#

Yeah not a problem at all for now just odd it only takes that