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

Can't use Sandbox to show previews #420

Open
johannes-lindgren opened this issue Oct 4, 2024 · 1 comment
Open

Can't use Sandbox to show previews #420

johannes-lindgren opened this issue Oct 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@johannes-lindgren
Copy link
Collaborator

johannes-lindgren commented Oct 4, 2024

Describe the bug

Both the sandbox and editor (in Storyblok) has an input field where you can specify the URL of the field plugin:

image

But the field plugin is now refusing to post message to any other host than app.storyblok.com, meaning that you can't display previews anymore.

For example, the code block field plugin uses an older version of the library, which means that you can preview it with a Vercel preview:

https://plugin-sandbox.storyblok.com/field-plugin?url=https%3A%2F%2Fstoryblok-code-block.vercel.app%2F

image

But this doesn't work with the latest version of the library.

To Reproduce

Try to use the sandbox or editor with any field plugin on the most recent version:

  1. If you're not serving in dev mode, you won't be able to use the sandbox
  2. If you're not serving in production mode, you won't be able to use the editor

Or try to use the sandbox in local development mode:

image

See https://plugin-sandbox.storyblok.com/field-plugin?url=https%3A%2F%2Fstoryblok-code-block.vercel.app%2F

Expected behavior

For previews to work again, as outlined in the docs: https://www.storyblok.com/docs/plugins/field-plugins/continuous-delivery#preview-urls

Cause

This line:

  // ToDo: In development we need to load localhost:3300
  const origin =
    typeof targetOrigin === 'string'
      ? targetOrigin
      : host === 'plugin-sandbox.storyblok.com'
        ? 'https://plugin-sandbox.storyblok.com'
        : 'https://app.storyblok.com'
@johannes-lindgren johannes-lindgren added the bug Something isn't working label Oct 4, 2024
@johannes-lindgren johannes-lindgren changed the title Can't use Sandbox or editor to show previews Can't use Sandbox to show previews Oct 4, 2024
@johannes-lindgren
Copy link
Collaborator Author

This would also be a problem for clients who self-host, or if Storyblok at some point changes the URL.

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

No branches or pull requests

1 participant