Skip to content

Enable parsing of JSON env vars #2849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Genyus
Copy link
Contributor

@Genyus Genyus commented Jun 18, 2025

Description

Modifies how environment variables are parsed to avoid JSON parsing errors.

Currently, variable parsing calls show value, but the show function in Haskell automatically adds quotes around strings and escapes internal quotes. So when you have:

PG_BOSS_NEW_OPTIONS={"teamConcurrency":3}

it gets converted to:

PG_BOSS_NEW_OPTIONS="{\"teamConcurrency\":3}"

The value that gets passed to JSON.parse() includes the outer quotes and escaped inner quotes, which is why it fails.

Fixes #2846

Select what type of change this PR introduces:

  1. Just code/docs improvement (no functional change).
  2. Bug fix (non-breaking change which fixes an issue).
  3. New feature (non-breaking change which adds functionality).
  4. Breaking change (fix or feature that would cause existing functionality to not work as expected).

Update Waspc ChangeLog and version if needed

If you did a bug fix, new feature, or breaking change, that affects waspc, make sure you satisfy the following:

  1. I updated ChangeLog.md with description of the change this PR introduces.
  2. I bumped waspc version in waspc.cabal to reflect changes I introduced, with regards to the version of the latest wasp release, if the bump was needed.

Add a regression test if needed

If you did a bug fix, make sure you satisfy the following:

  1. I added a regression test that reproduces the bug and verifies the fix.

If you're unable to add a regression test, please explain why.
This likely indicates that our current testing setup needs improvement.

Update example apps if needed

If you did code changes and added a new feature, make sure you satisfy the following:

  1. I updated waspc/examples/todoApp and its e2e tests as needed and manually checked it works correctly.

If you did code changes and updated an existing feature, make sure you satisfy the following:

  1. I updated waspc/examples/todoApp and its e2e tests as needed and manually checked it works correctly.

Update starter apps if needed

If you did code changes and updated an existing feature, make sure you satisfy the following:

  1. I updated starter skeleton as needed and manually checked it works correctly.
  2. I updated basic starter as needed and manually checked it works correctly.
  3. I updated todo-ts starter as needed and manually checked it works correctly.
  4. I updated embeddings starter as needed and manually checked it works correctly.
  5. I updated saas starter as needed and manually checked it works correctly.

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.

Passing JSON in env variables is broken
1 participant