I’m running FarCry 7.2.9 on Lucee 5.2.9.31 . When I run “Update Application”, I get the following error and the site no longer renders:
key [TYPE] doesn’t exist. The specific sequence of files included or processed is /var/www/farcry/core/packages/farcry/alterType.cfc, line: 375
I tried updating app via the url string (?updateapp=1 and ?updateapp=updateappkey), but still get this error. The only way to get the site back up is to restart the ColdFusion server.
Unfortunately that is a false positive on what the real error is (kind of annoying with FarCry). To get around it, dump the error in your Application.cfc’s onError() method. I do this for “all” my projects. To be honest, this should be just included as part of the FarCry installation. If using in production (as my sample code below is used for dev), I strongly suggest wrapping the dump in a condition for users who are logged into the webtop only (or admins only if you don’t want content editors seeing the exact error).
Here is my onError() method I use while on my dev machine (note: I also abort after the error. That’s up to you if you want to keep it there):
public void function OnError(required any exception, string eventName = {}) hint = "Fires when an exception occures that is not caught by a try/catch." {
// Used during development/testing
writeDump(var = arguments.exception top = 5 expand = true label = "arguments.exception" abort = true);
// Call the main farcry Application.cfc
super.OnError(argumentCollection = arguments);
}
After several tries, this doesn’t seem to produce a dump of the error, the same page as above produces. Either I’m doing the below wrong in Application.cfc or something else is up. Thanks for the help, do you have any other ideas?
<cffunction name="OnError" access="public" returntype="void" output="true" hint="Fires when an exception occures that is not caught by a try/catch.">
<!--- Define arguments. --->
<cfargument name="Exception" type="any" required="true" />
<cfargument name="EventName" type="string" required="false" default="" />
<!--- Used during development/testing --->
<cfdump var="#arguments.exception#" top="5" expand="true" label="arguments.exception" abort="true">
<!--- Call the main farcry Application.cfc --->
<cfset super.OnError(argumentCollection=arguments) />
<!--- Return out. --->
<cfreturn />
</cffunction>
It does look like that’s the error that is being thrown, the tricky part is understanding why
If you look at the stack trace you’ll see it’s throwing an exception on line 375 in updateJoins() of alterType.cfc, which is called from refreshAllCFCAppData() on line 490. So from that, we know that the framework is trying to initialise the components in your project (and plugins and core) and is hitting a problem.
Line 375 is this;
<cfif listcontainsnocase("array,uuid",
arguments.stCOAPI[thistype].stProps[thisproperty].metadata.type)
and structkeyexists(arguments.stCOAPI[thistype].stProps[thisproperty].metadata,"ftJoin")>
The key type only appears in one place on that line; arguments.stCOAPI[thistype].stProps[thisproperty].metadata.type
From that I would guess that you have perhaps recently changed a content type and one of the properties in that content type is missing a type attribute. And yes this is something we should catch so that we can then throw a particular error message that gives you more detail about what’s happened.
You’ll generally want to make sure your properties look something like this, including the standard attributes (name, type, etc) and then your FarCry Formtools attributes (ft*…);
That was exactly the issue - a missing type attribute. Thankfully, I was able to narrow down the updated content type files and quickly found the missing attribute. Thanks @justincarter and @jeff for your help!
I forgot to mention adding output=true on the CFC itself (another reason I only use this on dev). This should help in the future so that you don’t have to try tracking down the error the hard way.