URLFor() not working

79 views
Skip to first unread message

funaroma

unread,
Apr 24, 2022, 1:10:59 PM4/24/22
to CFWheels
Upgraded to CFWheels 2.2. Now redirects/etc are not working and the root cause appears to be a change in UrlFor(...)

For example,

URLFor(controller="Admin", action="dashboard")

Is only rendering an output of:

/admin

Where should I start looking to troubleshoot this?

funaroma

unread,
Apr 24, 2022, 1:43:22 PM4/24/22
to CFWheels
Additional info:

During debugging, in this file:

/wheels/global/misc.cfm Line 669

I added a condition to ignore the wildcard route:

} else if (StructKeyExists(local.params, "route") && len(local.params.route) && local.params.route != "wildcard") {

And URLFor() started giving the correct output, and redirects and other functions that rely on URLFor seem to be working, but i have no idea what this might break.

funaroma

unread,
Apr 24, 2022, 2:03:00 PM4/24/22
to CFWheels
Correction... URLFor works, but redirectTo still acting very strange. Obviously modifying core files is only for debugging, just trying to hunt down the issue.

Risto

unread,
Apr 25, 2022, 1:29:01 PM4/25/22
to CFWheels
Hi funaroma,

When I first started using wheels 2.2 i was running into that issue sometimes but not always. I then just started to use the route="theroute" and stopped using controller, and action and have no issues.
I remember if I used redirectTo() with just the action param in the same controller it worked but not when going to a different controller.

Maybe Peter Amiri will chiime in and can shed more light on it.

funaroma

unread,
Apr 25, 2022, 1:39:17 PM4/25/22
to CFWheels
Yes, I could add a route for every possible controller/action, but that would be a pretty ridiculous thing to have to do. Rails would never require that, as that's the whole point of having a controller/action convention and the application framework that supports it with all types of urls to begin with. The overhead of having to create a named route for every single possible request would be enough to make me switch frameworks, lol.  Plus, it was working before. something is clearly different with this version than the prior one I upgraded from.

Risto

unread,
Apr 25, 2022, 2:21:44 PM4/25/22
to CFWheels
Yeah, I agree. Shouldn't be too hard to fix as it used to work. I was just saying that moving forward with new apps I got in the habit of using just the route name. 1 param better than 2:)

Risto

unread,
Apr 25, 2022, 2:25:46 PM4/25/22
to CFWheels
It's almost as if they wanted us to only use route="" as adam cameron found out when he traced what was happening on the Github issue. Basically route is the only thing that is getting passed so doesn't seem too hard to pass controller and action with it.

funaroma

unread,
Apr 26, 2022, 9:38:15 AM4/26/22
to CFWheels
So is this an actual bug, and is the framework still under active support/maintenance by the creators? If i had the time and knew a bit more I'd submit a pull request myself but i'm afraid my solution would be both hacky and poorly tested. =D

Peter Amiri

unread,
Apr 27, 2022, 1:13:00 PM4/27/22
to CFWheels
Hi Funaroma,

Sorry for the delay in replying. I've been out of the country for the last few weeks. As you discovered this is a bug. The fix should be in the soon to be released v2.3.0 but since this was causing people from even going through the getting started tutorials the fix has been applied to the Forgebox package already. It would be great if you could test your app with the wheels folder from the Forgebox package and confirm if it resolves your issues.

I hope you have CommandBox installed. (if you don't you should, ;-) In a clean directory enter "box install cfwheels-core". Then grab the wheels folder from the downloaded package and replace your wheels folder with it. This is still v2.2.0 so it shouldn't cause any issues but it has the hot fix for this bug applied. It would be good to know for sure that this squashes the bug in the wild.

Let me know if I can help.

-Peter

funaroma

unread,
Apr 30, 2022, 11:45:56 AM4/30/22
to CFWheels
No joy on the cfwheels box install:

~newNheels $ box install cfwheels-core.png

funaroma

unread,
Apr 30, 2022, 12:15:53 PM4/30/22
to CFWheels
I think i was able to get this working by cloning the CFWheels repo and pulling the current master branch, then copying the wheels folder into my current app.

Peter Amiri

unread,
Apr 30, 2022, 12:45:41 PM4/30/22
to cfwh...@googlegroups.com
Great. You basically did the same thing. The master branch has that fix in it so that’s why it fixed your issue. But just know that you pulled some of 2.3.0-wip down as well. It should be fine but I wanted to make sure you are aware of that.

-Peter

-Peter Amiri
 Sent from my iPhone
 (auto-typing mispell disclaimer in effect)

On Apr 30, 2022, at 9:15 AM, funaroma <advan...@gmail.com> wrote:

I think i was able to get this working by cloning the CFWheels repo and pulling the current master branch, then copying the wheels folder into my current app.
--
You received this message because you are subscribed to the Google Groups "CFWheels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cfwheels+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cfwheels/86154168-1cda-4374-a6cf-6e9279d62372n%40googlegroups.com.

funaroma

unread,
Apr 30, 2022, 12:58:22 PM4/30/22
to CFWheels
Thanks, yes I checked the changelog and saw that there's some 2.3.0 stuff in there. so far everything seems to be working. Thanks for the nudge in the right direction!
Reply all
Reply to author
Forward
0 new messages