hi,
Do I have to re-register the PDF Document Generation service every time I redeploy?
No. You do not need to re-register the PDF Document Generation service on every deployment to the same environment. The registration is intended to be done once per environment as part of the initial setup.
What the registration actually does
- When you register an environment using the Snip_AppRegistration snippet, it stores the PDF service configuration (App ID + token).
- This registration ties your app environment to the Mendix public document generation service.
- Once registered, that environment can generate PDFs without needing to re-register after each deploy.
Why it sometimes fails after redeploy
Even though you shouldn’t have to re-register, there are a few common real-world scenarios where you might see errors until you refresh the registration:
- Environment URL changed
- If you change the environment URL (e.g., restore DB to another environment), the stored registration no longer matches, and you must re-register.
- Token expired / not auto-refreshed
- The PDF service uses short-lived tokens to talk to your app. The module includes a scheduled event (
SE_AccessToken_Refresh) to automatically refresh this token — but if that scheduled event never ran (e.g., app was idle), the token may expire, requiring re-registration. - Network access restrictions
- If your environment has path-based restrictions (e.g.,
/docgen/) or IP restrictions, the document service may not reach your app during PDF generation. You may need to configure those in the environment first.
Does a normal deploy break the registration?
No. Standard redeployments (builds to the same environment) do not expire or remove the registration token — the registration is preserved in your app database and configuration.
How to avoid needing to re-register manually
To prevent manual re-registration in the future:
- Make sure you have the scheduled event SE_AccessToken_Refresh enabled — this ensures the PDF service token is kept valid automatically.
- Make sure the environment does not block the DocGen path (
/docgen/) — if access restrictions exist, allow bidirectional communication. - Do not restore database backups from another environment to this one without re-registering — because the stored app ID/token may no longer match.