I’m getting an “invalid json response body” error when trying to set up my NextJS codebase with multiple projects in plasmic-init.
My initialize code:
export const PLASMIC = initPlasmicLoader({
projects: [
{
id: process.env.NEXT_PUBLIC_PLASMIC_PROJECT_ID, // ID of a project you are using
token: process.env.NEXT_PUBLIC_PLASMIC_PROJECT_API_TOKEN, // API token for that project
},
{
id: process.env.NEXT_PUBLIC_PLASMIC_PARTNER_PROJECT_ID, // ID of a project you are using
token: process.env.NEXT_PUBLIC_PLASMIC_PARTNER_PROJECT_API_TOKEN, // API token for that project
},
{
id: process.env.NEXT_PUBLIC_PLASMIC_CONSUMER_PROJECT_ID, // ID of a project you are using
token: process.env.NEXT_PUBLIC_PLASMIC_CONSUMER_PROJECT_API_TOKEN, // API token for that project
},
{
id: process.env.NEXT_PUBLIC_PLASMIC_LANDING_PAGE_PROJECT_ID, // ID of a project you are using
token: process.env.NEXT_PUBLIC_PLASMIC_LANDING_PAGE_PROJECT_API_TOKEN, // API token for that project
},
],
// Fetches the latest revisions, whether or not they were unpublished!
// Disable for production to ensure you render only published changes.
preview: process.env.NEXT_PUBLIC_DEPLOYMENT_ENV !== 'production',
})
Error message with project IDs replaced:
Error: invalid json response body at <https://codegen.plasmic.app/api/v1/loader/code/preview?platform=nextjs&projectId=[PROJECT_ID_1]&projectId=[PROJECT_ID_2]&projectId=[PROJECT_ID_3]&projectId=[PROJECT_ID_4]> reason: Unexpected token < in JSON at position 0
Is there anything I’m doing wrong or should look into for this? Setting the projects array to have only one project works just fine.