Skip to content

Conversation

@sshaw
Copy link
Contributor

@sshaw sshaw commented Sep 19, 2025

What this PR does

The auto-generated initializer has various starting time checks to prevent app misconfiguration before running. This did not apply to ShopifyAPI::Context's host: keyword. If the HOST env var was not present, a unhelpful "TypeError (Passed nil into T.must)" error was raised by Sorbet. Now if there is no HOST env var present, the app will fail to run, like it does with other checks, and the user will receive a helpful message.

As mentioned in #1710 and #1526

Sorbet 🤮

Reviewer's guide to testing

Things to focus on

In generated project: config/inititalizers/shopify_app.rb

Checklist

Before submitting the PR, please consider if any of the following are needed:

  • Update CHANGELOG.md if the changes would impact users

This should be done by the maintainer at release time, not by contributors.

The auto-generated initializer has various starting time checks to
prevent app misconfiguration before running. This did not apply to
ShopifyAPI::Context's host: keyword. If the HOST env var was not
present, a unhelpful "TypeError (Passed `nil` into T.must)" error was
raised by Sorbet. Now if there is no HOST env var present, the app
will fail to run, like it does with other checks, and the user will
receive a helpful message.
@sshaw sshaw requested a review from a team as a code owner September 19, 2025 04:02
api_secret_key: ShopifyApp.configuration.secret,
api_version: ShopifyApp.configuration.api_version,
host: ENV['HOST'],
host: ENV.fetch('HOST'),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this is only a 90% improvement because what does Sorbet regurgitate when it's an empty string? A good ol user-raised ArgumentError or TypeError with a nice message is best but, this is quick and simple.

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.

1 participant