Skip to content
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

Storybook doesn't build with env vars? #526

Open
reefdog opened this issue Jan 24, 2024 · 1 comment
Open

Storybook doesn't build with env vars? #526

reefdog opened this issue Jan 24, 2024 · 1 comment

Comments

@reefdog
Copy link
Contributor

reefdog commented Jan 24, 2024

I'm not entirely sure the framing of the issue title is correct. But maybe!

While reviewing #510, I noticed that the story for AddDataInstructions threw an error: Cannot access uninitialized variable. I don't see this error when running Storybook locally, but it's been a problem on all the deployed versions.

I have a suspicion that the culprit is process.env.REACT_APP_API_URL. This is the first time an environment variable shows up in Storybook-accessible code. I'm guessing that the Storybook build process doesn't know about it.

This isn't a crisis, but we should fix!

Possible reference:

reefdog added a commit that referenced this issue Jan 29, 2024
This commit changes where we pluck the API URL off our env vars to pass
them into our `NewBulkUploadPanel` component.

Previously, we read the env var directly within the component. This is
the first time a component accessed env vars, and presented an issue
with our Storybook story (#526).

Now, we pass it into the prop from the page. While this would still
present a Storybook issue if we tried to render that page, it resolves
our current dilemma.

Issue #514 Implement new layout/copy on New Bulk Upload page
Issue #526 Storybook doesn't build with env vars?
@reefdog
Copy link
Contributor Author

reefdog commented Jan 29, 2024

Since #533 we no longer trigger this issue because I moved the env var out of the component in question, to its surrounding page (which isn't loaded into Storybook). But we should still come up with a solution to this, if for no other reason than to educate ourselves.

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

No branches or pull requests

1 participant