Skip to content

Promises Not Resolving After Upgrading SvelteKit Packages #14713

@singhjaskaran0501

Description

@singhjaskaran0501

Describe the bug

After upgrading the SvelteKit dependencies, API calls made to backend servers no longer resolve their promises when the page is reloaded. The issue does not occur when the user navigates between pages — in that case, the promises resolve correctly and data loads as expected.

This behavior appeared after updating to the newer versions of SvelteKit packages.

Temporary Workaround
Downgrading the following packages restores normal behavior:

"@sveltejs/adapter-node": "5.3.1",
"@sveltejs/kit": "2.36.3"

After reverting to these versions, the promises resolve correctly in all cases.

Expected Behavior
API calls should behave consistently between page reloads and client-side navigation. Promises should resolve correctly in both cases.

Reproduction

  1. Upgrade to the latest versions of @sveltejs/kit and @sveltejs/adapter-node
  2. Implement an API call inside a load function that fetches data from a backend server
  3. Reload the page directly
  4. Observe that the promise for the API call never resolves
  5. Navigate between pages using client-side routing — observe that it works normally.

Example

+posts.server.ts

export const load: PageLoad = async ({ fetch, depends }) => {
  return {
    posts: fetch(url('/posts?_limit=5'))
  };
};

+page.svelte

<script lang="ts">
  export let data: {
    posts: Promise<any>;
  };
</script>

{#await data.posts}
Loading....
{:then posts}
  <ul>
    {#each posts as post}
      <li>
        <h3>{post.title}</h3>
        <p>{post.body}</p>
      </li>
    {/each}
  </ul>
{/await}

System Info

System:
  OS: macOS
  Node: v22.18.0
  npm: 10.9.3

Packages:
  @sveltejs/kit: [latest version] (❌ causes issue)
  @sveltejs/adapter-node: [latest version] (❌ causes issue)
  svelte: 5.x
  vite: 6.x

Adapter:
  Node adapter (using `adapter-node`)

Environment:
  Mode: development

Severity

blocking an upgrade

Additional Information

This issue seems related to how SvelteKit handles SSR or the load lifecycle during full-page reloads in recent versions. There might be a regression or change in async handling on the server side.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions