remix: Server Timeout on deferred routes

What version of Remix are you using?

2.2.0

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

Follow up from this issue: https://github.com/remix-run/remix/issues/4493

  1. Create a remix project with @vercel/remix @supabase/auth-helpers-remix and tailwindcss

  2. Create a route with a loader deferring results from supabase

  3. Add cache control headers

  4. Make changes to tailwind and save

  5. Refresh the route (a couple of times to trigger the timeout)

Expected Behavior

Expected to have deferred or cached result to come through.

Actual Behavior

After refreshing the page you will experience a Server timeout error from the error boundary or Await’s errorElement.

About this issue

  • Original URL
  • State: open
  • Created 8 months ago
  • Reactions: 1
  • Comments: 18 (5 by maintainers)

Most upvoted comments

HEllo, i have the same issue ⬆️

with :

├── @remix-run/dev@2.8.0
├── @remix-run/eslint-config@2.8.0
├── @remix-run/express@2.8.0
├── @remix-run/node@2.8.0
├── @remix-run/react@2.8.0
├── @remix-run/serve@2.8.0
├── @tailwindcss/forms@0.5.7
├── @types/luxon@3.4.2
├── @types/react-dom@18.2.20
├── @types/react@18.2.64
├── html-to-react@1.7.0
├── isbot@5.1.1
├── npm@10.5.0
├── react-dom@18.2.0
├── react@18.2.0
├── remix-toast@1.2.0
├── remix@2.8.0
├── typescript@5.4.2

I’m getting this error as well, on 2.8.0. When I save changes to my project and the page reloads (or if I do a manual refresh), I always get the “Server timeout” error on routes that fetches from a 3rd party api. ABORT_DELAY is set to 20_000 just for testing. After navigating to another route and then back again, it starts working. Edit: both when running locally and in azure cloud.

Can confirm issue still exists when you reload a page with streaming. If you navigate from a different page to this page it works well but If you refresh this page it throws time out error. Opening this page link on a different tab throws error

here is my example

export async function loader() {
  const getData = async () => {
    await new Promise((resolve) => setTimeout(resolve, 1000));
    return {
      name: "Product name",
      image: `https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQo4sBM1qm7OEiInjW5oZVF4q67s-HxnVzRL1kEagILpQ&s`,
    };
  };

  const query = getData();

  return defer({
    query,
  });
}

export default function Test() {
  const { query } = useLoaderData<typeof loader>();
  return (
    <div>
      <h1>Test</h1>

      <Suspense fallback={<p>Hey cool streaming on remix</p>}>
        <Await resolve={query}>
          {(data) => (
            <>
              <h2>{data?.name}</h2>
              <Image src={data?.image} alt={data?.name} />
            </>
          )}
        </Await>
      </Suspense>
    </div>
  );
}

I ended up updating remix libs to 2.8.0 and this hasn’t come up yet, no changes were made besides this. Will close this once I get to the account that opened the issue.

same here, i was just testing out remix

i deferred a setTimeout promise and the server times out in the client

actually resolves the promise but can’t swap the UI