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 5 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.

@sodic sodic self-requested a review June 24, 2025 15:59
@sodic
Copy link
Contributor

sodic commented Jun 26, 2025

Hey @Genyus, thanks!

I'll take a look at this tomorrow probably.

@infomiho infomiho self-requested a review July 7, 2025 12:42
@sodic
Copy link
Contributor

sodic commented Jul 7, 2025

Hey @Genyus, apologies, we've been a bit busy.

@infomiho is back now so he'll take it over later in the week. Thanks for the patience!

@sodic sodic removed their request for review July 7, 2025 18:29
Copy link
Contributor

@infomiho infomiho left a comment

Choose a reason for hiding this comment

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

Good job @Genyus on sorting this out. I have some small comments.

When you can, please merge main into your branch to get the CI to pass (we fixed the job types bug recently).

Genyus added 2 commits July 14, 2025 09:36
@Genyus
Copy link
Contributor Author

Genyus commented Jul 14, 2025

@infomiho Applied the suggested changes, but still seeing unexpected build errors

@infomiho
Copy link
Contributor

@Genyus which build errors are you seeing? Are you referring to the failing CI?

The CI is failing due to e2e tests not being up to date, you can run them locally with ./run test:e2e and regenerate them (which you want to do with ./run test:e2e:accept-all) and then make a commit with the changes. Let me know if you need help with that!

@Genyus
Copy link
Contributor Author

Genyus commented Jul 16, 2025

@infomiho Thanks for the pointer, CI is now passing 👍🏾

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
3 participants