Support > Forums > OpenBots Server > Exception when calling CredentialsApi.GetCredentials

Exception when calling CredentialsApi.GetCredentials

Jan Renec

  • Reporter
  • Calender Icon June 25,2021 at 11:19 PM

Hi all,

My config -OpenBots Server, Agent, Studio version 1.5.1

I created -Credential -Agent (status: connected) -Automation with initial code: ShowMessage['"Hello World"') Next -I publish it to server -I created Schedule with Manual option

After Run I see in log (C:\Users&lt;user_name>\AppData\Local\OpenBots Agent\Logs\log<YYYYMMDD>.txt :

2021-06-26 00:36:10.711 +02:00 [INF] Event Name: Job Execution | Log Message: Attempt to execute process 2021-06-26 00:36:11.164 +02:00 [ERR] Event Name: Job Execution | Log Message: Error occurred while executing the job; ErrorMessage = System.InvalidOperationException: Exception when calling CredentialsApi.GetCredentials: Object reference not set to an instance of an object. in OpenBots.Server.SDK.HelperMethods.CredentialMethods.GetCredentials(UserInfo userInfo, String credentialId) in OpenBots.Service.Client.Manager.Execution.ExecutionManager.ExecuteJob() in OpenBots.Service.Client.Manager.Execution.ExecutionManager.NewJobsCheckTimer_Elapsed(Object sender, ElapsedEventArgs e)

I run automation in attended Mode without problem as well in OpenBots Studio

What can I do to run Schedule?

This forum has 65 topics, 191 replies, and was last updated 2 months ago by Ghouse Shaik

Andy Menon

  • Participant
  • Calender Icon August 06,2021 at 4:30 PM

Thanks Nataly. Yes, I see that the automations work now.

I'm publishing the solution here in the hope that other members of the community will find helpful.

Solution:

When setting up a Job on the server, the argument values must be passed in to the automation as follows:

Text type input arguments must be passed in without double-quotes.

Example: Some_Arg_Value

    and not
"SomeArgValue"

If your text type argument value is a file path, pass them in as exemplified below:

Example: C:\Path\To\My\File.txt (no double quotes)

    and not
@"C:\Path\To\My\File.txt"

Finally, if you have assigned default values to the input arguments, make sure to remove the double-quotes around the text input arguments and/or fix the file paths as shown above when creating a Job on the server.

Thanks!

Nataly Alvarado...

  • Participant
  • Calender Icon August 06,2021 at 2:37 PM

Hi Andy,

Thanks for contacting us. I am glad the issue was resolved and that we were able to answer your questions. The error message was caused because of a formatting mismatch between Server and Studio while passing Arguments in a scheduled automation.

We will get this resolved in the next release.

Thanks for the input!

Andy Menon

  • Participant
  • Calender Icon August 01,2021 at 6:03 PM

I see what might be the reason. I tested another much simpler automation, and that also failed. So the issue is not with the automation but with the setup somewhere.

Here is the path of the script that the scheduler is showing in the logs:

C:\Users\XXXXX\AppData\Local\OpenBots Inc\OpenBots Agent\Automations\OpenBots\77563c5d-e235-4385-9fc4-0b595b3f624a\95cebd91-14c7-4225-890c-469909492128

But the actual location of the script on my (agent) machine is one level up. The extra folder above doesn't exist!

C:\Users\XXXXX\AppData\Local\OpenBots Inc\OpenBots Agent\Automations\OpenBots\77563c5d-e235-4385-9fc4-0b595b3f624a

An FYI: My server is on an entirely different physical machine on the home network and the agent is connected successfully to server over HTTPS.

Andy Menon

  • Participant
  • Calender Icon August 01,2021 at 5:49 PM

This worked! To echo what others have stated on this thread, the training content could be updated very simply with a message in bold stating that this step is required for v1.5 onwards. That would make a whole lot of difference.

And Yes! I was able to at least kick off unattended automations from my server. That said, the server logs indicate that the automation has Job Status = Completed with Successful = Yes, but when I check the logs I see this error (below)). All automations have been tested in Studio + they work successfully as Attended Automations without errors. However, I don't know why this error persists in unattended mode.

This is the Error message from the Logs:

Error: Microsoft.CodeAnalysis.Scripting.CompilationErrorException: (1,34): error CS1003: Syntax error, ':' expected at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.ThrowIfAnyCompilationErrors(DiagnosticBag diagnostics, DiagnosticFormatter formatter) at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.CreateExecutor[T](ScriptCompiler compiler, Compilation compilation, Boolean emitDebugInformation, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Scripting.Script`1.GetExecutor(CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Scripting.Script1.RunFromAsync(ScriptState previousState, Func2 catchException, CancellationToken cancellationToken) at OpenBots.Core.Utilities.CommonUtilities.VariableMethods.<InstantiateVariable>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at OpenBots.Engine.AutomationEngineInstance.<ExecuteScript>d__77.MoveNext()

This is the Job Properties (the agent is successfully connected): { "JobId": "0f55a428-23da-4b78-a598-10e26bdbfee4", "AutomationId": "e85d800b-2f8f-40ae-83cd-03a107501c17", "AutomationName": "002-WeatherAPI-Prototype", "AgentId": "2e97b689-a619-45cc-88f6-b8b2ccfed057", "AgentName": "XXXXXXXXXXXXXX", "MachineName": "XXXXXXX" }

thanks!

Nataly Alvarado...

  • Participant
  • Calender Icon June 29,2021 at 9:16 PM

I'm glad to help!

we recently released v1.5.0, which included a lot of necessary additions and improvements to the tool. Unfortunately, not all documentation has been updated. But please, don't hesitate to ask your questions on the forums.

Jan Renec

  • Participant
  • Calender Icon June 29,2021 at 8:28 PM

Hello Nataly

I did not know that https protocol is required.

The Academy Courses are bit ;) outdated.

Thanks for your support.

Now I can run my unattended automations :)

Nataly Alvarado...

  • Participant
  • Calender Icon June 28,2021 at 10:32 PM

Hello Jan,

If you are in version 1.5.0 or higher, then the error is caused because of OpenBots Server new requirements. In order to be able to call the credential commands or use the Active Directory agent credentials (which happens when a job runs) you will need to use an https connection. Meaning, you will need to bind a self-signed certificate to your OpenBots Server. This was added as a safety measure, to ensure credentials are always shared through a secure protocol.

You can find detailed documentation about OpenBots core components by enrolling to Academy. For example, we have a complete guide on Self Signed Certification creation and binding. To Access it, please navigate to OpenBots Academy > OpenBots Setup and Configuration > Self-Signed Certification Creation and Binding for Sandbox Environment (you will need to enroll to the course in order to access it)

Direct Link: Self-Signed Certification Creation and Binding for Sandbox Environment

You are not authorized to reply, please click here to login and add your reply to this topic.