Server Connect Not inheriting the query param NodeJS

Maybe I’m misunderstanding how it’s supposed to work, but according to this from the documentation, the server connect should automatically see the param on the server side without having to add it as a $_GET variable directly to the server connect, but it never appears server side:
It is important to understand that the Server Connect used on the page inherits all the input query parameters or route path parameters of the current page, so it will automatically “see” them in the URL.

Here is the HTML of the test page:

Here is the routing:

I can render query.test_id on the page:

Here is the api file with both values set to output:

Here is the result in the console:
Screenshot 2024-02-08 at 1.44.25 PM

Thanks in advance,

I could be wrong but I believe the parameter name needs to be the same.

It looks like you have test_id in the server action and routing, but globalcruds_id in the HTML test page.

Yea I caught that after I took the screenshot, but even after they all matched it doesn’t work. I’ll upload a new screenshot. I thought I had screenshot it afterwards haha.

I’ve been having this issue all week. NodeJS params won’t inherit in the Server Connect and the API Datasource.

You are mixing server connect routes and page routes.

The route in your screenshot is for a page - so the param is only available on the page.
To make the value available on any server action used on the page via server connect, you need to pass the value.

If you create a server connect route (which is actually a route for server action/API), then in the SA you will be able to access the value under $_PARAM.

Thanks for the reply, @sid I know how to pass the value directly on the server connect from the front end, I’m actually trying to do what you say in the last sentence. Access it on the server side via the $_PARAM without passing it directly on the server connect from the front end. Perhaps, I’m still not understanding what the diference in $_PARAM and $_GET on the back end is.

The only case where that would work is in the Server Side Server Action.
On the page’s App node, if you have set the server action under server side data option, then that server action can access the URL param via $_PARAM.

Otherwise, only if a server action is opened via server connect route (not from a page) directly as a page, the params are available under $_PARAM.

P.S. This all probably sounds like jargon, but I would have to write a lot more to explain it in words. So hope you can make some sense of it.

You are correct, I think I’m more confused now haha. Appreciate the reply. I’ll need to read your explanation later when I’m more alert. I’ll probably understand it then. Got up WAAAYYY to early this morning.

FYI, this is what I was following when the $_PARAM didn’t work as expected.

The tutorial you pointed refers to Server-Side Rendering, in which a Server Connect is directly bound to the page server-side:

It doesn’t apply to your current situation, what you’re doing is the “traditional” Wappler way of calling a Server Action, which is a case of client-side rendering.

Thank you, I’ll have a look at that. Appreciate the help.

From what I can tell, select server action only works with meta tags, which I have working successfully. But it won’t work the way I was expecting. I’ll shleve this for now. Appreciate all you guys’ help.