Skip to content

Fix SMART_EXTRACT_API_HOST env variable for Custom Executor execution#8838

Open
sanjacornelius wants to merge 2 commits into
developfrom
bugfix/FOUR-30560-B
Open

Fix SMART_EXTRACT_API_HOST env variable for Custom Executor execution#8838
sanjacornelius wants to merge 2 commits into
developfrom
bugfix/FOUR-30560-B

Conversation

@sanjacornelius
Copy link
Copy Markdown
Contributor

@sanjacornelius sanjacornelius commented May 20, 2026

This PR resolves an issue where the SMART_EXTRACT_API_HOST environment variable was not being properly returned when CUSTOM_EXECUTOR was enabled and SCRIPT_MICROSERVICE was disabled.

The fix ensures that the SMART_EXTRACT_API_HOST environment variable is correctly injected and available regardless of which executor configuration is being used.

Root Cause

The environment variable was only being properly configured for Script Microservice execution paths. When running scripts through the Custom Executor with the Script Microservice disabled, the variable was not available within the execution environment.

Solution

Updated the environment variable handling to ensure SMART_EXTRACT_API_HOST is consistently available for both:

  • Script Microservice execution
  • Custom Executor execution

How to Test

  1. Enable CUSTOM_EXECUTOR
  2. Disable SCRIPT_MICROSERVICE
  3. Ensure Smart Extract environment variables are configured in the .env file
  4. Run a Script Task with the following code:
    getenv('SMART_EXTRACT_API_HOST')
  5. Verify that the expected host value is returned successfully.

Related Tickets & Packages

ci:deploy
ci:package-smart-extract:task/FOUR-31337

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

Append SMART_EXTRACT_API_HOST and SMART_EXTRACT_REQUEST_TIMEOUT to the variablesParameter in ProcessMaker/ScriptRunners/Base.php. The change injects smart-extract.api_host and smart-extract.request_timeout from configuration so script runners receive the Smart Extract service host and request timeout values at runtime.
@sanjacornelius sanjacornelius requested a review from eiresendez May 20, 2026 17:05
@Kookster310
Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://ci-6e7b2eafd7.engk8s.processmaker.net

Copy link
Copy Markdown
Contributor

@eiresendez eiresendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The change works! Please consider addressing the review comment if you consider it critical 👍

Comment thread ProcessMaker/ScriptRunners/Base.php Outdated
Include SMART_EXTRACT_API_HOST and SMART_EXTRACT_REQUEST_TIMEOUT inside both the escaped and non-escaped branches when building variablesParameter so they are properly escaped when $useEscape is true. Remove the duplicated lines that were appended outside the conditional. This ensures SMART_EXTRACT settings are consistently included alongside HOST_URL.
@processmaker-sonarqube
Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@Kookster310
Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://ci-6e7b2eafd7.engk8s.processmaker.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants