Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desk crashes with Uncaught Error: Workspace: missing context value #724

Open
ilyagru opened this issue Nov 2, 2023 · 8 comments
Open

Desk crashes with Uncaught Error: Workspace: missing context value #724

ilyagru opened this issue Nov 2, 2023 · 8 comments
Labels
bug Something isn't working triaged

Comments

@ilyagru
Copy link

ilyagru commented Nov 2, 2023

Describe the bug

When embedding the studio into a Next.js app, the desk tool crashes and throws an error "Uncaught Error: Workspace: missing context value". What's interesting is that I have 2 identical projects and one of them works fine, the other crashes with the mentioned error. If I build the studio separately and go to localhost:3333/studio, it doesn't crash.

What could be the issue?

To Reproduce

Steps to reproduce the behavior:

sanity.config.ts

import { defineConfig, isDev } from 'sanity'
import { deskTool } from 'sanity/desk'
import { visionTool } from '@sanity/vision'
import { schemaTypes } from './src/schemas'

export default defineConfig({
  name: 'default',
  title: 'app-studio',
  projectId: '...',
  dataset: 'production',
  basePath: '/studio',
  plugins: [
    deskTool(),
    ...(isDev
      ? [
          visionTool({
            defaultApiVersion: 'v2023-11-02',
            defaultDataset: 'production'
          })
        ]
      : [])
  ],
  schema: {
    types: schemaTypes
  }
})

Expected behavior

No error is thrown.

Screenshots
If applicable, add screenshots to help explain your problem.

Screenshot 2023-11-02 at 11 34 31 Screenshot 2023-11-02 at 11 33 36 Screenshot 2023-11-02 at 11 34 17

Which versions of Sanity are you using?

Sanity v3.19.0
Next.js both v13.5.5 and v14.0.1

What operating system are you using?

macOS 14.1

Which versions of Node.js / npm are you running?

Run npm -v && node -v in the terminal and copy-paste the result here.

Node.js v18.18.2
pnpm v8.10.0

Additional context

Add any other context about the problem here.

Security issue?

Any security issues should be submitted directly to security@sanity.io. In order to determine whether you are dealing with a security issue, ask yourself these two questions:

  • Can I access something that's not mine, or something I shouldn't have access to?
  • Can I disable something for other people? If the answer to either of those two questions are "yes", then you're probably dealing with a security issue. Note that even if you answer "no" to both questions, you may still be dealing with a security issue, so if you're unsure, just email us at [security@sanity.io](mailto:security@sanity.io.
@stipsan stipsan added the bug Something isn't working label Nov 5, 2023
@Steffi3rd
Copy link

Same problem

@oblodev
Copy link

oblodev commented Dec 9, 2023

Got the same problem. Same node version:
image

@jessetan
Copy link

I'm hitting this issue as well when trying to create a custom nav bar using the instructions at https://www.sanity.io/docs/studio-components-reference#db9fc60782a3

npm v10.2.3
Node v21.2.0

@stipsan stipsan added the triaged label Jan 2, 2024
@manimul
Copy link

manimul commented Jan 5, 2024

I just had this issue happening quite randomly on a Remix project with an embedded Studio. No work was being done on the Sanity schemas or setup when it started happening. It would crash when i went to add new content on a Sanity document.
I was able to get around it by opening the local Studio in a new browser on Incognito mode, and logging in again to Sanity, So perhaps it's some caching issue?

@federicocappellotto97
Copy link

Same here

"next": "14.0.4",
"next-sanity": "^7.0.10",
"@sanity/vision": "^3.24.1",
"sanity": "^3.24.1"

Worked before updating, now i get Error: Workspace: missing context value

@Vinam09
Copy link

Vinam09 commented Jan 28, 2024

Running into the same issue with my project, Has anyone found a workaround?

@abdealisaria
Copy link

Same error: missing context value.
My local sanity studio works fine using npm run dev
When I use sanity deploy that studio throws the same error.
image

@fostimus
Copy link

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged
Projects
None yet
Development

No branches or pull requests

10 participants