nuagedelait / sanity-pagebuilder

Sanity plugin to create a fast website admin with pagebuilder
MIT License
17 stars 1 forks source link

Error: Could not resolve workspace `default` #2

Open adalmagro opened 7 months ago

adalmagro commented 7 months ago

Hi, I am getting the following error after installing the plugin:

` Error: Could not resolve workspace 'default':

default: Could not resolve workspace 'default':

My sanity.config.ts is as follows: `import {defineConfig} from 'sanity' import {structureTool} from 'sanity/structure' import {visionTool} from '@sanity/vision' import {schemaTypes} from './schemas' import { pagebuilderTool } from '@nuagedelait/sanity-pagebuilder'

export default defineConfig({ name: 'default', title: 'XXXXXXXXX',

projectId: 'XXXXXXXXXXXX', dataset: 'XXXXXXXXXXXXXXX',

plugins: [structureTool(), visionTool(), pagebuilderTool()],

schema: { types: schemaTypes, }, })`

I am newcome to sanity. Any help please?

nuagedelait commented 7 months ago

Hey !

Can you tell me which version of sanity are you using ? This bug was introduced with the last changes on the sanity structure tool.

Are you on the v1.1.0 of the plugin ? Normally this bug has been fixed on the last version https://github.com/nuagedelait/sanity-pagebuilder/commit/ee1823fb4ea0ce299ef73cbda7eb1b64f6367ef2

adalmagro commented 7 months ago

Hi, yep, the plugin version is 1.1.0 and Sanity version is the latest 3.30.0

npoch commented 7 months ago

I resolved this by adding a staging a prod workspace:

[
  {
      name: 'pb-prod',
      title: 'Pagebuilder-Production',
    basePath: '/production',
      projectId: '#######',
      dataset: 'production',
      plugins: [
      structureTool(),
      pagebuilderTool({
        addBlocksSchemas: [],
        addContentSchemas: [],
        addManagmentSchemas: [],
        api: 'sanity api version, default : `v2023-08-01`',
        // languages: [],
      }),
    ],
      // schema: {
      //   types: schemaTypes,
    // },
  },
  {
  name: 'pb-staging',
  title: 'Pagebuilder-Staging',
  projectId: '######',
  dataset: 'production',
  basePath: '/staging',
  plugins: [
    structureTool(),
    pagebuilderTool({
      addBlocksSchemas: [],
      addContentSchemas: [],
      addManagmentSchemas: [],
      api: 'sanity api version, default : `v2023-08-01`',
      // languages: [],
    }),
  ],
  // schema: {
  //   types: schemaTypes,
  // },
},
]

This goes into the defineConfig in sanity.config.ts

The documentation on this from Sanity is inaccurate. it has a couple of syntax errors. I put in a request to fix that too.

I ran into the next error... but new errors are still progress. I hope this helps.

nuagedelait commented 7 months ago

I think the problem is the basepath attribute of the configuration (I always have one because all my studios are on a subpath). Can you try your previous configuration and add a basepath attribute ? I will make some ajustement next month if I have time.

npoch commented 7 months ago

That worked for me but now I get a different issue.

image
export default defineConfig(
  {
      name: 'production',
      title: 'Pagebuilder-Production',
    basePath: '/production',
      projectId: '<ProjectId>',
      dataset: 'production',
      plugins: [
      // structureTool(),
      visionTool(),
      pagebuilderTool({
        addBlocksSchemas: [],
        addContentSchemas: [],
        addManagmentSchemas: [],
      }),
    ],
      schema: {
        types: schemaTypes,
    },
  },
)

I added the visionTool() because I was getting an error saying I had no tools installed.

image

Either way I still cannot create anything in the docs. When I click create then any of the document types listed, the url changes but nothing happens on the screen.

nuagedelait commented 7 months ago

Hey I released v1.1.1, can you try it ?

npoch commented 7 months ago

1.1.1 resolved the issue!!!!! @nuagedelait THANK YOU!!!! MERCI!!!!! for the records, I needed both structure builder and pagebuilder tool configured

export default defineConfig(
  {
      name: 'production',
      title: 'Pagebuilder-Production',
    basePath: '/production',
      projectId: '<ProjectID>',
      dataset: 'production',
      plugins: [
      structureTool(),
      visionTool(),
      pagebuilderTool({
        addBlocksSchemas: [],
        addContentSchemas: [],
        addManagmentSchemas: [],
      }),
    ],
      schema: {
        types: schemaTypes,
    },
  },
)
nuagedelait commented 7 months ago

Great :) there are still some minor bugs that I found testing with a clean sanity project (I used it with a Nextjs all the time and forgot to test it out of the framework). I will release another version soon as soon as I have a little more time

adalmagro commented 7 months ago

Hi!, Now it works for me with version 1.1.1 and same configuration just initializing as below: pagebuilderTool({ addBlocksSchemas: [], addContentSchemas: [], addManagmentSchemas: [], }), Thank you very much!