[closed] Error when running Update Application

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.

Any ideas what might be causing this error?

Here is the full error

There was a problem with that last request

Please push “back” on your browser or go back home

Error Overview

Core Version: Unknown
Machine: Unknown
Instance: Unknown
Message: key [TYPE] doesn’t exist
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
DateTime: {ts ‘2019-08-06 13:54:19’}
Host: yyy.com
HTTPReferer: yyy.com/webtop/index.cfm?id=content
QueryString: id=content&updateapp=1
RemoteAddress:xxx.xxx.xxx
Bot: not a bot

Error Details

Exception Type: expression
Tag Context: * /var/www/farcry/core/packages/farcry/alterType.cfc (line: 375)
  • /var/www/farcry/core/packages/farcry/alterType.cfc (line: 490)
  • /var/www/farcry/core/tags/farcry/_farcryApplicationInit.cfm (line: 103)
  • /var/www/farcry/core/Application.cfc (line: 315)
  • /var/www/farcry/core/Application.cfc (line: 621)
  • /var/www/farcry/core/Application.cfc (line: 435)
  • /var/www/farcry/core/webtop/Application.cfc (line: 10)|

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);
}

AWESOME, we will check it out. We were lost!

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>

Hmmm… Let’s see if any of these get us anywhere.

  1. Did you restart the application?
  2. Have you tried patching FarCry? (getting the latest core from p720)

It does look like that’s the error that is being thrown, the tricky part is understanding why :slight_smile:

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*…);

	property name="purchaseID" type="uuid" required="false" 
		ftSeq="10" ftWizardStep="" ftFieldset="" ftLabel="Puchase ID"
		ftType="uuid" ftJoin="bobPurchase" ftAllowCreate="false" ftAllowEdit="false";

Assuming you’re using source control you should be able to look at a diff of your working copy and you might be able to spot what you’ve changed.

Hope that helps :smiley:

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!

1 Like

Awesome. Thanks all!!!

1 Like

Glad you got it working. Thanks Justin.

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.