FAQs
Less than to read
Is it mandatory to validate the Node bindings and run the npm run generate command every time after the metadata gets modified in Sage X3?
You must validate the nodes and generate the packages. Therefore, it is mandatory to run the npm run generate command every time after the metadata suffers modifications in Sage X3.
The build is not sufficient as it only compiles sources generated after the npm run generate command is run or from manually developed sources like pages or client functions.
How to generate just one package?
To generate just one package, you can run the command npm run generate-package from the package function.
Note: If you have dependencies between your packages, you must run the npm run generate command. This command must be run from the root folder of the Sage X3 Builder Developer Studio to build your packages properly. In such cases, generating a single package might cause some errors during the build. For example:
How to use properties from the standard packages in computed properties?
To use properties from the standard packages in computed properties, you must import the standard nodes you want to use at the beginning of your function. For example:
import { theStandardNode } from '@sage/package-of-the-standard-node';
Why can’t I see all the standard packages in the sandbox?
Only the dependencies added to the package started in VS Code are displayed in the GraphQL sandbox. These dependencies are visible in the package.json files.
Why do mutations fail with one of these errors?
If you get one of the above errors while working with mutations, make sure you have configured your xtrem-config.yml file properly. An example of a properly configured xtrem-config.yml can be seen in the image below:
For mutations, GraphQL API uses the Syracuse Server secret id to connect to Sage X3. Therefore, you must add the secret
line to the api
section of your xtrem-config.yml file.
Notes:
- The
secret
id in the xtrem-config.yml file is entered without quotation marks. - Indents are important in the xtrem-config.yml file.
- In the
api
section, use an URL with the server’s name, not localhost.
The GraphQL secret id must match with the secret id defined in Sage X3:
Note: The new Syracuse Server setup displayed in the image above replaces the configuration previously done in the nodelocal.js file. Therefore, the etna
chapter of the nodelocal.js file displayed in the image below is not required anymore if the new setup is defined in Sage X3:
If you modify the Syracuse Server secret id, you must restart the Syracuse Server service in the Windows Services Manager:
Why does the npm run generate command fail with circularity error?
If you encounter this error, it is because a circular dependency has been detected in your packages. This means a package A depends on package B and package B depends on package A.
To fix this, you must fix the metadata in Sage X3.
Can GraphQL be called with a query in the URL directly?
No. A GraphQL query can be very long and complex. Therefore, it does not make sense to be passed in the URL as a HTTP request.
The GraphQL query must be sent as a payload.
It is possible to use the same field on multiple API packages?
Yes, but you might require using a linked package to access the field.
Note: As a property is linked to a table, this table can also be included in one or many nodes and packages.
It is possible to code a static method in a node?
No. If you code a static method in a node, you will lose the static method the next time you run the npm run generate command as the node is reconstructed from the Sage X3 metadata.
What kind of licenses are needed to start using the GraphQL API in Sage X3?
There’s no control of licenses right now to use GraphQL API in Sage X3.
Why is the endpoint not necessary in the GraphQL query?
A GraphQL query takes your current endpoint set for the session.
You can change the endpoint via the frontend of Sage X3 (or handheld) or you can use the Syracuse Server API to do so from a third-party app.
Is x3_services going to be separate from ADC?
Yes, in the future.
How can we change the tokens for ADC?
Communication to Sage X3 Services API on a non-developer environment like VS Code is routed via Syracuse Server. Therefore, if you are posting to the <server>:8124/xtrem/api
endpoint, you require a Sage X3 session/token.
What is the status for Classes and Representation?
Classes and Representation are still used. Classes can also be mapped in the API Operations function. However, no enhancement for both is planned in the roadmap for now.
Why is the code of my page not recognized in VS Code?
To make sure the code of your page is recognized in VS Code, you must tick the following checkbox in the VS Code settings:
How can I change the port?
You can change the port by adding the following code to your xtrem-config.yml</code> file:
server:
port: 8241
The above code denotes the port the main service is listening on.
This process spawns a set of workers for the request endpoint, if not already spawned, and then forwards the request to a worker. The worker port is dynamic and should be printed in the logs.
Note: If you change the port and restart the service, ensure the config URL is correct on the solution/endpoint on Sage X3.
How to setup a request timeout?
For GraphQL queries, add the following lines to the xtrem-config.yml file:
x3:
sql:
requestTimeout: 30000
For GraphQL mutations, add the following lines to the xtrem-config.yml file:
graphql:
timeLimitInSeconds: 120