Plasmic sync (NextJS) is now importing executeServerQueries from files that do not exist

Hi,

Plasmic Sync now seems to have removed the logic for generating server queries from each individual page it syncs down, and is now attempting to import a function from files which do not exist / are not being created on sync;

import { executeServerQueries } from "./__loader_rsc_ProjectHtmlImportsHomepage";

We updated the CLI to latest to see if that helps, but it made no difference.

We have implemented a temporary fix by recreating the function based on older versions of the file and regex replacing the repo with the new import, but this issue happens every sync and thus will need to be done every time.

import { executeServerQueries } from "@/lib/plasmic/util/executeServerQueries";

import {
  executeServerQuery,
  ServerQuery
} from "@plasmicapp/react-web/lib/data-sources";

const $$ = {}

export async function executeServerQueries($ctx: any) {
  const $queries: Record<string, any> = {};

  const serverQueries: Record<
    string,
    ServerQuery<(typeof $$)[keyof typeof $$]>
  > = {};

  do {
    await Promise.all(
      Object.keys(serverQueries).map(async key => {
        $queries[key] = await executeServerQuery(serverQueries[key]);
        if (!$queries[key].data?.isUndefinedServerProxy) {
          delete serverQueries[key];
        }
      })
    );
  } while (
    Object.values($queries).some(value => value.data?.isUndefinedServerProxy)
  );

  return $queries;
}

Thought I’d bring this to your attention, as it doesn’t seem to have been mentioned on the forums at all.

This was not an issue previously, and first occurred for us last week on Jan 8th.

Hi @angelo_hague, thanks for the report, we’re looking into this now. Can you let me know the ID of the project you’re syncing? It’s probably not necessary to reproduce the issue, but there’s a chance it’s only affecting your project for some reason.

@angelo_hague Nevermind, I’ve identified the issue - no need to provide a project ID.

1 Like

@angelo_hague Can you confirm a couple things?

  • Is your project using app directory/react server components?
  • Are you using server queries/dynamic data in your page metadata?

I’m having a hard time reproducing your exact issue, although there does seem to be a problem with executeServerQueries imports.

Hi @samuel_pullman,

Sorry for the late reply again,

  • We’re using the App Directory
  • I notice there were some empty Data Queries added to pages in Plasmic (added but with no integration defined), which I have just removed, but this does not seem to have solved the issue.

@angelo_hague No problem, thanks for the details. This should be fixed by tomorrow.

@angelo_hague I believe your issue is fixed now. We’re still in the process of fully supporting SSR in app dir projects, so there will be more updates and improvements coming soon.

Let me know if anything else comes up, and if you have any questions/suggestions about it!