Service runs on dev but fails on staging

Hello,

Is there any reason why our services would run on dev, but fail on staging? On the service log, it states “Job fails” without a specific error code.

1 Like

Hello,

I think the first step would be to observe where the service fails by using the devTools for services.

On the top of my head, the reason the service might fail in Staging is because of larger amounts of data or different types of data that throws unhandled exceptions (e.g. doing toString() on undefined)

I also recommend adding some sort of logs to your services.

Please reach out if you can’t find the error or have anymore questions :slightly_smiling_face:

//Erik

Thank you, Erik!

We believe it might be because of larger amounts of data.

We have tried using devTools for services, however, when the service crash, the whole devtools becomes unresponsive. It would be better for us if this tool worked.

Would we be able to see the error messages using event logging?
@ErikAKSkallevold

Hello Sinan Maric,

If the service is timing out or being evicted due to large amounts of data, then you are unlikely too see this in your eventlog.

DevTools for services hooks into the service to log what is happening server-side, so if the service is evicted or shut down it might hang. Hot reloading is being worked on, but is not present at the moment.

How is your service set up and what does it do? Does it contain a lot of database connected datasources or function properties? These would slow down your service when the amount of data increases, and could potentially be the reason your service is failing.

//Erik

Hi!

The Role of the Service Account that is running this service in Staging: Have you verified that it has the correct permissions?

In general, it is recommended to test the Service using a test-user without “god-permissions”, as stated in the blue box here: Developer tools for Services | Appfarm Documentation

This was another service, not the one I made the post for. Because when we tested the service I made the post for on Friday it crashed in staging. But it works now.

So, think it is good for now. I have another question. What is the different between “Services” and “Schedules” under “Logs”?

Some services that is running appears under “Services” while some under “Schedules”

Execution of Service Schedules are always logged in Logs → Schedules.

But logging of executions of a Service Endpoint (which may be triggered by an external API call, from an App, manually in DevTools/Swagger, or from a Schedule) has to be enabled manually here:

Note that if a Service Endpoint is triggered by a Service Schedule, but it has no “Enable Log” checked, the execution of it will only be visible in Logs → Schedules.

1 Like

I understand, thank you!