Tag Archives: copy

Google Cloud scheduler call to Cloud functions 401 error

I used to run some functions developed and deployed on Google Cloud Run Functions.

Some of them are scheduled to run via Cloud Scheduler.

Last time I decided to copy the definition of the Cloud Scheduler job from bot 2 to my new bot3 function. And I started to get 401 unauthenticated errors for bot3, but the same definition was working fine for bot2.

The error looks like below:

debugInfo: "URL_ERROR-ERROR_AUTHENTICATION. Original HTTP response code number = 401"
jobName: "projects/....../locations/europe-west6/jobs/......"
status: "UNAUTHENTICATED"
targetType: "HTTP"

and in the Cloud Function log is the misleading:

The request was not authorized to invoke this service. Read more at https://cloud.google.com/run/docs/securing/authenticating Additional troubleshooting documentation can be found at: https://cloud.google.com/run/docs/troubleshooting#401

BUT – actually the problem is that during the copy of the scheduler job definition, the “Audience” value IS NOT updated with the new function URL (in my case bot3), but the old function URL is kept. It seems like it was autofilled in bot2 definition though and I didn’t noticed it. So be sure that URL and Audience are properly set!

If you fix this the 401 error is solved and gone!!!

I hope I saved you some time. Post one thanks in comments if so …

Fix VirtualBox (copy/move/restore) VM

If you have moved a VM or have an old copy of working VM, you can land in situation where the VirtualBox software is reinstalled or moved and you get errors when you restore old VMs or move some.

Could not find an open hard disk with UUID {2219b9d1-8931-418c-a7d5-d5ce00c81b7c}.
Result Code:
VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)
Component:
VirtualBoxWrap

or

Virtual Box UUID {17c3.........} does not match the value {3c1b...} 
stored in the media registry ('/home/user/.VirtualBox/VirtualBox.xml')
Machine UUID {899a89219ax-7d55-8381-01ac-288288101} doesn't match its UUID {0388cb75-f076-4992-ab96-ed8d2ff99623} in the registry file
Result code: NS_ERROR_FAILURE (0x80004005}

The solution I found is based on the answers here:

https://stackoverflow.com/questions/15074878/virtual-box-uuid-07c3-does-not-match-the-value-2c1b-stored-in-th and my experience.

First – check if you have running the VirtualBox with the right user! Sometimes errors can occur if you have installed the VirtualBox with different user and the current one is not admin or does not have enough rights!!!

Second – fix the UUID like below.

Copy existing VM (duplicate) via VirtualBox to create a new folder and working VM.

Rename the VirtualBox.vdi file to VirtualBox0.vdi of the new VM.

Get the UUID of the working VM with the following command:

The result should look like:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands dumphdinfo VirtualBox0.vdi
--- Dumping VD Disk, Images=1
Dumping VD image "polikont_feb2016-disk1.vdi" (Backend=VDI)
Dumping VDI image "polikont_feb2016-disk1.vdi" mode=r/o uOpenFlags=9 File=0x0002586d731290
Header: Version=00010001 Type=1 Flags=0 Size=85888373760
Header: cbBlock=1048576 cbBlockExtra=0 cBlocks=81910 cBlocksAllocated=13687
Header: offBlocks=512 offData=328192
Header: Geometry: C/H/S=1024/255/63 cbSector=512
Header: uuidCreation={0388cb75-f076-4992-ab96-ed8d2ff99623}
Header: uuidModification={24bde4bc-e7cf-4d60-8f40-a257b3460228}

Set UUID to the restored/copied VM which was giving error (I have renamed it to VirtualBox.vdi in the directory of the working copy, after I have renamed the working VDI to VirtualBox0.vdi and taken its UUID as shown above). So set its UUID as follow:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands sethduuid  VirtualBox.vdi 0388cb75-f076-4992-ab96-ed8d2ff99623

Replace the UUID (0388cb75-f076-4992-ab96-ed8d2ff99623) with your result from dumphdinfo command!

*** This was experienced and tested in VirtualBox 7.0 under Windows 10 at May 2024.