You’re likely hitting two different issues here.
First, the Google doc you followed is for Apigee local development / VS Code + emulator. That page explicitly documents deployments.json for local environments, and it shows that serviceAccount can be attached to a proxy or shared flow in that file. It even notes that this feature requires emulator 1.9.2+.
Second, your target environment is an Apigee X archive-deployment environment, and those behave differently. Google’s archive-deployment docs say that when an environment is enabled for archive deployment, Apigee blocks a subset of management actions in that environment, including managing API proxy or shared flow revision deployments through the normal UI/API/gcloud paths. The shared flows page also says that in archive-enabled environments, shared flows can’t be managed through the Apigee UI, API, or gcloud the usual way.
So the most likely explanation is:
-
The emulator accepts a local-development extension of deployments.json
-
The server-side validator for Apigee X archive deployment does not accept serviceAccount in deployments.json
-
That is why you see: json: unknown field “serviceAccount” on Google Cloud, even though it works locally.
There is also a plain JSON syntax error in the sample you pasted: you are missing a comma between the two shared flow entries.
Your pasted block has:
{
"sharedflows": [
{
"name": "sf-common-gcloud-logging",
"serviceAccount": "(PII Removed by Staff)"
}
{
"name": "sf-common-security"
}
]
}
It must be:
{
"sharedflows": [
{
"name": "sf-common-gcloud-logging",
"serviceAccount": "(PII Removed by Staff)"
},
{
"name": "sf-common-security"
}
]
}
That missing comma is real, but it is not the reason for the specific unknown field “serviceAccount” error. That error points to schema validation, not just malformed JSON.
What to do next:
-
Remove serviceAccount from deployments.json for archive deployment and try again.
-
Keep the file to the archive-deployment-safe shape, for example:
{
"proxies": [
{ "name": "graphql" },
{ "name": "graphql-passthrough" },
{ "name": "rest" }
],
"sharedflows": [
{ "name": "sf-common-gcloud-logging" },
{ "name": "sf-common-security" }
]
}
- If you need Google auth from policies, configure it in the proxy/shared-flow implementation using the supported Apigee runtime auth mechanism, rather than expecting archive deployment to bind a service account through deployments.json. The local-development doc’s serviceAccount support appears to be an emulator/VS Code feature, not something the archive deployment backend currently honors.
So the core answer is: the emulator and Apigee X archive deployment are not validating against the same schema here. The doc page you used is describing local-development behavior, and Google Cloud archive deployment is rejecting that extra field.
A practical rule for now: for archive deployments to Apigee X, treat deployments.json as containing only the deployable artifact list (proxies, sharedflows) and not runtime binding metadata like serviceAccount.