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

[Docs]: Standardize and document prerendering environment variable __REDWOOD__PRERENDERING #10372

Open
1 task
ched-dev opened this issue Mar 29, 2024 · 4 comments

Comments

@ched-dev
Copy link
Contributor

Summary and description

I recently use the process.env.__REDWOOD__PRERENDERING environment variable to check if I was within the prerendering build step but couldn't find any documentation on it. I believe it should be documented within the Environment & Variables documentation.

I think it could be standardized to drop the double underscore prefix as well.

Are you interested in working on this?

  • I'm interested in working on this
@ahaywood
Copy link
Contributor

ahaywood commented Apr 2, 2024

Hey @ched-dev Thanks for filing. Would you be interested in contributing to the docs and sharing your use case?

@Tobbe
Copy link
Member

Tobbe commented Apr 2, 2024

It's "private", that's why it has the double underscore prefix.

Can you explain your use case a bit more please? That way we might be able to come up with a more official way of supporting what you want to do, rather than exposing an internal implementation detail 🙂

@pantheredeye
Copy link
Collaborator

FWIW, some background in this thread https://discord.com/channels/679514959968993311/1221949945280467065

I have been experiencing my prerendering hanging when I try to deploy to Railway.app. I notice it always stops right after the last prerendered page (404 page in my case). It finishes on my local machine, but not when it’s up in Railway. However, it seems my local build just ends after the last prerendered page and I would assume it to exit with some kind of success message. Is that normal?

OK I think I found the issue!

When I set the cache to use InMemoryClient during build it will successfully complete. If it's set to RedisClient during build it will hang.

I remember having this issue on Vercel a while ago but I fixed it by using the InMemoryClient during build step only. When I changed to Railway I must not have moved that over.

Now I am using process.env.__REDWOOD__PRERENDERING === '1' to check if I am prerendering, then switching cache to use InMemoryClient instead.

Is there a different way to check if I am running a build step? The double underscores makes me feel this could change in the future.

DT offers a few different suggestions in the thread.

@Tobbe
Copy link
Member

Tobbe commented Apr 5, 2024

Thanks for the extra context @pantheredeye

So it seems we should first try to better understand what's going on here, and then decide what to do.

@ched-dev Would you be up for trying DT's suggestions as well, and report back any and all details you can find? Just so we get a full picture of the issue.

I would prefer it if we could fix/handle this inside the framework, so that users don't have to think about this themselves 🙂 We want RW to solve these kinds of weird cases for our users! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants