Internal Server Error after Fusion Auth Upgrade to v 1.9.1 - fusionauth

I have attempted to upgrade a production environment fusion auth instance from version 1.6.x to 1.9.1 unfortunately after the database migration we are presented with error 500 page when browsing to the app.
I have taken a look at the logs which shows the following error:
Sep 24, 2019 4:16:03.726 PM ERROR
com.inversoft.scheduler.LogAndRetainFailureHandler - The scheduled
service [class io.fusionauth.api.service.cache.ThemeCacheLoader]
failed but will be re-run.
java.lang.IllegalStateException: Invalid
message value for theme at
io.fusionauth.api.domain.CachedTheme.loadProperties(CachedTheme.java:40)
at io.fusionauth.api.domain.CachedTheme.(CachedTheme.java:24)
at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1321)
at
java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
at
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at
java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at
io.fusionauth.api.service.cache.ThemeCacheLoader.load(ThemeCacheLoader.java:34)
at
io.fusionauth.api.service.cache.ThemeCacheLoader.run(ThemeCacheLoader.java:40)
at
com.inversoft.scheduler.InjectableRunnable.run(InjectableRunnable.java:37)
at
com.inversoft.scheduler.DefaultScheduler.(DefaultScheduler.java:74)
(I have truncated the log output on purpose, if needed I can edit question with full log)
I have also looked in the themes table which contains two entries. The first has a very large JSON object string literal in the data column the second just has any empty JSON object i.e. "{}".
I am reaching out as hopefully this is a simple data issue? Does anyone have any ideas? Thanks in advance

This is a known issue that can occur when you have a custom theme defined prior to upgrade.
A fix will be available shortly in version 1.9.2, a work around is described in the above linked GitHub issue and provided below as well. https://github.com/FusionAuth/fusionauth-issues/issues/306
Workaround:
For each theme other than the default FusionAuth theme
Use the Retrieve Theme API
Set a value for the defaultMessages such as empty string
Update the theme using the Update Theme API
https://fusionauth.io/docs/v1/tech/apis/themes

Related

ITS_CANT_LOAD_INCLUDE "Template interpretation terminated, syntax error"

We have this trouble:
We have been changing styles in our ITS Mobile applications, due to we have acquired new handhelds which are Android and the one we are replacing are Windows OS.
We have always used the WebGui style but the new handhelds with Android can't show popups and that's why we are transforming the styles to MOBILE4 and because, according to SAP, WebGui style is obsolete now.
The problem is that, when testing in Q&A, we are having dumps when we access the applications through handhelds, both Windows and Android.
The dumps show this:
The template zitsmobile\99\zmm_dynnr_50.html
contains syntax errors and therefore could not be compiled. Cause of
error: Include "include/sound" does not exist
The syntax error is in row: 50, column: 87
The HTMLB row with errors is:
" include(~service="itsmobile", ~language="", ~theme="99",
~name="include/sound.html");"
We tried to change the style to just MOBILE but dump is another message:
The template zitsmobile\99\zmm_dynnr_50.html
contains syntax errors and therefore could not be compiled. Cause of
error: Include "include/sound" does not exist
The syntax error is in row: 33, column: 87
The HTMLB row with errors is:
" include(~service="itsmobile", ~language="", ~theme="99",
~name="include/sound.html");"
Screen:
500 Internal Server Error
Template interpretation terminated, syntax error.
UPDATE:
We tried to change the style and problems in that server arose.
In fact, we notice that template RLMENU 2888 file is different in between Q&A environment and production environment.
If we try to regenerate template RLMENU 2888 then all the other applications trigger dumps.
So, regenerating template RLMENU 2888 makes it worse.
We are really confused of what to do in this case.
I finally fixed the issue.
The cause of the problem was that the ITSMOBILE internet service was not published in production.
When we published it finally the resource INCLUDE/SOUND and the rest were available.
However we had an issue after publishing.
We had to apply the SAP Note 2221538 - ITS_UNEXPECTED_TOKEN or ITS_UNDEFINED_NAT_FUNCTION dumps in ITSmobile application because there was a dump were we had to add declare the sh() function in INCLUDE/CUAAREA.html in ITSMOBILE.
The error in dump was ITS_UNDECLARED_FUNCTION.

Update build definition in team foundation 2015 API

I am busy with configuring our new TFS 2015 server (on premises) and trying to get the new vnext builds to work properly.
What I now have are some extra powershell scripts that increase the version number of my assemblies.
It also changes the buildnumber in TFS by calling the API method (see tfs rest api). My json body only sends the new build number (eg. {"buildNumber": "1.0.1.1234"}) and this works fine.
Now I have added some major, minor and patch version variables in the build definition for the version. Once the build is done this should be updated and so I thought to do the same kind of thing and just send an update API call to the corresponding builddefinition endpoint. The documentation says the revision number is mandatory so I have added that. For the rest I only added the changed variables.
The api call works, but the nasty thing is that it will update the whole definition and clear out all the other settings which I did not provide in the json body. I also tried first getting the defintion through the API, changing the json values for the variables and send that back but that didnt work correct also.
So does anybody know a good solution for this?
As a workaround what I did for now is adding a dummy build definition (eg. "_ProjectVersion") totally empty except for the variables and my build task now uses that build definition to get the latest version numbers and update them. So the api call still empties that whole build definition but since it only contains my variables I dont mind.
I am also doing this in powershell since all scripting should be automated and done in powershell.
The problem I have is that the API call to get the json of an existing BuildDefinition returns invalid json when managed in powershell.
For example the "#{multipliers=[]; will fail with 'must have at least one value' even though a 'json validator' may report as Valid. The correct json is {"multipliers": "[]",

Laravel Multi Auth set up issue

I have installed Multi Auth following instructions by ollieread at https://github.com/ollieread/multiauth, but i'm missing some point here.
I got this error when running my app before replacing the configuration for auth (config/auth.php):
ErrorException
Missing argument 1 for Illuminate\Auth\AuthManager::createDriver(), called in /private/var/www/portal-varejo/www/vendor/laravel/framework/src/Illuminate/Support/Manager.php on line 81 and defined
Im pretty sure that whats missing is this (from documentation):
Custom Auth Drivers
At this current moment in time, custom Auth drivers written for the base Auth class will not >work. I'm currently looking into this particular issue but for the meantime, you can work >around this by changing your closure to return an instance of Ollieread\Multiauth\Guard >instead of the default.
How can i do that? What closure i'm supposed to change?
Running Laravel 4.1 here.
You need to comment out 'Illuminate\Auth\AuthServiceProvider' and 'Illuminate\Auth\Reminders\ReminderServiceProvider' from app/config/app.php.

Enabling REST on HMVC CodeIgniter setup

I have just finished setting up an HMVC CodeIgniter following the steps here.
I am now trying to create a module "api" which I wish to use Phil Sturgeon's REST library.
It states here that I need to extend the MX_Controller rather than the CI_Controller and I did.
My initial setup was like this
application
--modules
----api
------config
------controller
------libraries
I kept getting an error with loading Rest_Controller so I have tried moving the REST_Controller and Format libraries to application/libraries that seemed to fix the loading issue but now i am getting the error below whenever i try to access it via http://example.com/codeigniter/index.php/api/example/user/id/1/format/json
"An Error Was Encountered
Unable to load the requested class: security"
I am expecting for the output to be "{"id":1,"name":"Some Guy","email":"example1#example.com","fact":"Loves swimming"}"
What am I missing? Would it be possible to keep the REST_Controller and Format libraries under the api module? If so, how?
Source
Open Rest_Controller.php go to line 173 and change the following code
$this->load->library('security');
to
$this->load->helper('security');
EDIT:
To have the REST_Controller and Format libraries under the api module.
Move the REST_Controller to api/controllers/REST_Controller.php and Format to api/libraries/Format.php

SQL Network Interfaces, error: 26 only on solution rebuild

I have a site built using MVC4 which is getting content out of a database and it all works fine.
If I then rebuild the solution and try to refresh the page to check my changes, I will always get the SQL Network Interfaces, error: 26 saying that I cannot connect to the server.
However, if I then browse to my homepage and then back to the page I was looking at it will work fine.
Does anyone know what could cause this problem as it is really annoying
EDIT
Further to this I have found it is when the AuthorizationContext filterContext is being loaded after the rebuild that it cannot connect to the db
EDIT 2
As with neil below I have found that I only get the problem if I try to access a page that has had a role assigned to it
I'm seeing the exact same problem and can trace it to the .ASPXAUTH session cookie in the browser. Delete that cookie and the database error goes away until the next rebuild.
The error occurs regularly if you are authenticated and then rebuild the project and try to browse any page that either:
Requires authentication
Makes a call to the User object (e.g. #if (User.IsInRole("Administrators")))
If you have the AuthorizeAttribute filter set in App_Start/FilterConfig.cs you'll get this on every page.
This seems to be new behavior following the most recent Patch Tuesday updates. Previously, I was seeing weird behavior where I would remain logged in but I would loose my roll membership. After the most recent patches, it seems Simple Membership chokes when it gets a bad .ASPXAUTH cookie (invalid because of the rebuild).
I've got the correct connection string in InitializeSimpleMembershipAttribute.cs but it's like Simple Membership is defaulting to something else in this one instance.
Note that I've moved the Simple Membership databases from the original (localDb) to a full-fledged (local) SQL Server instance. Don't know why that would matter, and it works fine in all other cases.
Update:
I've also tried making the connection string name the same as the EF context name (e.g. "ProjectContext") on the theory that it is defaulting to the standard convention, but that made no difference. I am explicitly identifying the connection string name in all my context class constructors (using the : base("connectionString") syntax) and Simple Membership is able to find the right connection string all other times.
Update 2:
The problem only occurs after rebuild when accessing a page protected by role. A simple [Authorize] won't trigger it. You need something like [Authorize(Role="Admin")]. I've replicated this on a new MVC 4 project with no other modifications, using the default (localDb) database. Clear the cookie and that same user can access the protected content w/o any problems. I believe this is a core .NET or MVC bug and needs to be reported as such.
This happened to me while rebuilding the application when I was logged in the browser.
Deleting cookies fixed the problem for me.
When using SimpleMembership, this bug occurs with any use of Roles-not just in the controller, but also when I use:
if(Roles.IsUserInRole(rolename){...
I am late to the game with this answer, but I added [InitializeSimpleMembership] to my home controller and I think that fixed it.