Skip to content

YAML Environment Substitution Swallows Validation Errors #423

@stevensJourney

Description

@stevensJourney

Overview

When passing in an invalid YAML config via a Base64 string (might affect other methods also), the YAML validation error is not printed to the console. Instead only the JSON parsing error is shown. This makes it difficult to debug invalid configurations.

E.g. if passing in a YAML config which contains !env substitutions which have either undefined env vars or use variable names not starting with PS_ the following error is printed.

Error: Unexpected token 'r', "replicatio"... is not valid JSON 
{"stack":"Error: Could not collect config using Base64 method. Caught exception: Error: Could not parse PowerSync config file content as JSON or YAML: SyntaxError: Unexpected token 'r', \"replicatio\"... is not valid JSON\n    at CompoundConfigCollector.collectBaseConfig (file:///Users/stevenontong/Documents/platform_code/powersync/service/powersync-service/packages/service-core/dist/util/config/compound-config-collector.js:164:23)\n    at async CompoundConfigCollector.collectConfig 

(file:///Users/stevenontong/Documents/platform_code/powersync/service/powersync-service/packages/service-core/dist/util/config/compound-config-collector.js:27:28)\n    at async startUnifiedRunner (file:///Users/stevenontong/Documents/platform_code/powersync/service/powersync-service/service/src/runners/unified-runner.ts:10:20)\n    at async Command.<anonymous> (file:///Users/stevenontong/Documents/platform_code/powersync/service/powersync-service/packages/service-core/dist/entry/commands/start-action.js:12:9)\n    at async Command.parseAsync (/Users/stevenontong/Documents/platform_code/powersync/service/powersync-

service/node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js:1092:5)\n    at async runProgram (file:///Users/stevenontong/Documents/platform_code/powersync/service/powersync-service/packages/service-core/dist/entry/cli-entry.js:31:17)"}

The service should not swallow the YAML validation errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions