"MAC is invalid" 500 Error when upgrading from 2.01 to 2.1

In a desperate attempt to resolve my V8JS issue I decided to upgrade my DreamFactory instance.

I followed these instructions: https://wiki.dreamfactory.com/DreamFactory/Installation#Upgrade

and used git to install.

I didn’t have any installation errors from what I can tell, but after clearing my browser and artisan cache, I am greeted with the a blank white screen and the following 500 message from the /api/v2/system/environment: “The MAC is invalid.”

Steps I have tried:

  • Changing /Storage to 2777 permissions (recursively)
  • Changing /bootstrap to 2777 permissions (recursively)
  • Tried generating a new APP_KEY using “php artisan key:generate”
  • Restarting apache2 multiple times
  • Clearing browser cache multiple times

Nothing is being written to the server logs, nor the DreamFactory logs in Storage/logs

I’m out of ideas!

EDIT:: Appears this error is being thrown from bootstrap/cache/compiled.php around line 12710:

$payload = json_decode(base64_decode($payload), true);
if (!$payload || $this->invalidPayload($payload)) {
throw new DecryptException(‘The payload is invalid.’);
}
if (!$this->validMac($payload)) {
throw new DecryptException(‘The MAC is invalid.’);
}

Noticed that in …/config/app.php the APP_KEY was set to “SomeRandomString” as in the screenshot below. I’m assuming all did not go well with installation/update?

I changed it to the app_key value as found in .env, but nothing’s working still.

Okay, so i learned the very hard way!

DO NOT use artisan key:generate to create a new key if you are trying to troubleshoot. It interferes with some of the hashing that goes on internally with saved passwords, etc… Luckily I had my old APP_KEY saved some where.

Now that that is cleared up, I am receiving this error when opening from the browser:

file_exists(): open_basedir restriction in effect. File(/home/ubuntu/df2/public/…/…/.bitnamimeta/demo_machine) is not within the allowed path(s)

It’s a little odd, because I am not running on a bitnami machine. Perhaps I messed up the upgrade? Anyone have an idea what I did wrong?

So, to fix that last issue I went into: …/vendor/dreamfactory/df-core/src/Resources/System/

and modified the function isDemoApplication to return false, instead of looking for a file.

Case closed, ladies and gentlemen!

As a final step, i cleared the artisan cache (php artisan cache:clear) and cleared the browser cache once more. 6 hours of debugging later and voila! Seems to be back up!

I have to say, I very much enjoyed reading through this and seeing you do your own troubleshooting. Hope it all continues to work out!

Thanks, Drew. Unfortunately after all that I am back to square one with the : * no “require()” support in V8 library error popping up (v8js has been installed into my server according to “php -m”)

looks like this solved here: Ubuntu: Module "lodash" could not be found