A workflow runs fine when testing, fails without any helpful errors in production

Hello everyone.

I have a multi-step workflow that runs without errors during tests, but fails when triggered in production.

What’s more, I do not get any helpful errors:

As you can see on the screenshot above, there’s no log I can inspect. The red box with “Error Script returned exit code 1” is all I get (unlike other errors I have seen, it’s not clickable to expand more details).

This workflow does run sometimes with different trigger combinations. For example, I can confirm it has run successfully with email trigger, and with HTTP request trigger. But each time it runs successfully, and I change the trigger to what I really want (which is running it at a specific time every day), it starts to fail.

I also tried to keep the HTTP request trigger, and make that HTTP request from another workflow at my desired time of day, but it fails that way as well.

All I want is to somehow get the actual error message so that I can further debug the issue.

Any help appreciated!

Hi @mzrnsh

In my experience with Python steps, KeyErrors are the number one more common error that leads to this problem.

In production your data triggering a workflow will most likely be different than when testing. Sometimes data is missing or is in a different location than you’d expect.

I could add print statements in my steps to confirm the data looks as it should, that way you have more information to debug with.

1 Like

Hey @pierce , thanks for the suggestion.

I think the problem is that it doesn’t even seem to enter the Python script. At least, I am not getting any errors in the log.

Just in case, I added a print statement at the beginning of my Python script:

Still, it fails, and I am not getting the log with my message:

As you can see, unlike the other step, this one doesn’t even have a section to view the logs. That’s what I am finding weird about all this.

Thanks for the screenshots @mzrnsh they are very helpful.

You may be running into an issue with the imports of the modules themselves.

Have you tried using our magic comment system to define the importing of the boxsdk module?

The name of the module is different from the packages you’re importing from it, I wonder if that’s the cause here.

1 Like

Thanks again, Pierce :raised_hands: I didn’t know about magic comments, and maybe that’s what I should do… after solving this issue. Which I still think could be something else :grimacing: because it does run sometimes, even in production.

Right now, I just commented out all the python code and added a bunch of random characters to deliberately cause an error.

The workflow failed, as expected. But I am still not getting the log where I can inspect the issue in details. I wonder if that’s by design?

Let’s go with more screenshots…

Here’s a python step that is supposed to result in an error, and that’s what it does in workflow editor - we’re told that name 'asdasd' is not defined:

Now let’s deploy this workflow and schedule it to run in production. It fails, but there is no log to inspect:

As you can see on the screenshot, this step doesn’t have a section where I would see the log. If there were, I should be able to see the first print statement printed, and then the error message complaining about ‘asdasd’ not being defined.

So I guess I should rephrase my original question into this:

"How to view the log for failed python steps?"

I can confirm there is the log section when the step succeeds:

i.snipboard .io/DRUpGd.jpg

Hi @mzrnsh

Glad to hear the magic comments helped with the package installation.

Thanks for providing such a detailed bug report - Python, Go & Bash support are still in their early stages compared to Node.js, but we’re working to bring the same great logging, Component API and helper functionality.

I encourage you to make a Github Issue on our public repo for full error trace reporting on deployed workflows.

Thanks for your patience on this!