I recently upgraded a site to Umbraco v.7.3.0 and Contour stopped working. I received the infamous 500-error, /umbraco/Contour/FormsApi/GetAll.
We then upgraded Contour to version 3.0.28 and it all started working, the form picker showed up and I was able to pick forms and publish to pages. This was at the end of last week.
I then let our clients in to the site for testing and now the 500-error is back and no form picker is showing.
Is there anyone out there who has an idea of what could have happened?
This is the error message I got from Chrome dev toolbar:
{
"Message":"An error has occurred.",
"ExceptionMessage":"Object reference not set to an instance of an object.",
"ExceptionType":"System.NullReferenceException","StackTrace":" at Umbraco.Forms.UI.Security.HasAccessToForm(Guid form)\r\n
at Umbraco.Forms.Core.Providers.V7.PropertyEditors.FormsApiController.GetAll()\r\n
at lambda_method(Closure , Object , Object[] )\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass10.9(Object instance, Object[] methodParameters)\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()\r\n
at System.Web.Http.Controllers.ApiControllerActionInvoker.
@Christian Palm
No need to "Bypass the Security". You just need to specify namespace of 'Security' class. (Since Umbraco 7.3 - 'Security' is a new property to 'UmbracoApiControllerBase' class of type 'Umbraco.Web.Security.WebSecurity')
--
All you need to do is:
Declare alias to Umbraco.Forms.UI
using ui = Umbraco.Forms.UI;
Use new namespace alias
if (ui.Security.HasAccessToForm(f.Id))
Note: You can't use directly 'Umbraco.Forms.UI.Security.HasAccessToForm(f.Id)' because 'Umbraco' in this scope reffers to property on 'Umbraco.Web.WebApi.UmbracoApiControllerBase' of type 'Umbraco.Web.UmbracoHelper'
No form picker, just "clear"
Hi,
I recently upgraded a site to Umbraco v.7.3.0 and Contour stopped working. I received the infamous 500-error, /umbraco/Contour/FormsApi/GetAll.
We then upgraded Contour to version 3.0.28 and it all started working, the form picker showed up and I was able to pick forms and publish to pages. This was at the end of last week.
I then let our clients in to the site for testing and now the 500-error is back and no form picker is showing.
Is there anyone out there who has an idea of what could have happened?
Kind regards, Mattias
Hi Mattias and welcome to our :-)
Status code 500 is an internal server error so hopefully you'll find more details in the logs.
You can find the logs here Event Viewer > Windows Logs > Application.
Hope you can get some more info why you are getting the 500 error from these log files.
/Dennis
Thanks :)
Im not getting anything from the Event viewer..
This is the error message I got from Chrome dev toolbar:
{ "Message":"An error has occurred.", "ExceptionMessage":"Object reference not set to an instance of an object.", "ExceptionType":"System.NullReferenceException","StackTrace":" at Umbraco.Forms.UI.Security.HasAccessToForm(Guid form)\r\n at Umbraco.Forms.Core.Providers.V7.PropertyEditors.FormsApiController.GetAll()\r\n at lambda_method(Closure , Object , Object[] )\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass10.9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary
2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
1.GetResult()\r\nat System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter
at System.Web.Http.Controllers.ApiControllerActionInvoker.
Hi Mattias,
Okay, unfortunately you have hit into this issue http://issues.umbraco.org/issue/CON-863
This will be fixed in the next release of Umbraco Contour.
/Dennis
Hi Dennis,
I see, do you have any idea of when this will be released?
What I don¨t understand is that this problem seemed to be fixed when we upgraded to version 3.0.28 and then a couple of days later the error is back.
What could possibly chagned from one day to another?
Hi Mattias,
Unfortunetly I can´t give you an exact date, when the next version of Contour will be released I am sorry.
The fixed for this has been created, but not release yet. Yes sounds very odd that couple of days later the error is back.
Just for curiosity is there a specific reason why you are using Contour instead of Umbraco Forms, when you are running Umbraco v.7.3.0
/Dennis
Hi Mattias,
If you can send me an email on dennis (at) umbraco dot com, then I can sent you a patch that you could try.
/Dennis
I have fixed this problem with a work-around.
I created have created a new FormsApiController and removed the Security stuff :-)
Changed the URL in /App_Plugins/Contour/formpicker.controller to backoffice/api/formsapi/getall in my case.
The api controller is still only allowed to umbraco backend users! But it will not check for read access. Which is not a problem for our editors.
Here is the source for FormsApiController
@Christian Palm No need to "Bypass the Security". You just need to specify namespace of 'Security' class. (Since Umbraco 7.3 - 'Security' is a new property to 'UmbracoApiControllerBase' class of type 'Umbraco.Web.Security.WebSecurity')
-- All you need to do is:
Declare alias to Umbraco.Forms.UI
Use new namespace alias
Note: You can't use directly 'Umbraco.Forms.UI.Security.HasAccessToForm(f.Id)' because 'Umbraco' in this scope reffers to property on 'Umbraco.Web.WebApi.UmbracoApiControllerBase' of type 'Umbraco.Web.UmbracoHelper'
is working on a reply...