Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Unable to preview media assets locally #319

Closed
SeraphRoy opened this issue Jan 8, 2023 · 4 comments · Fixed by #324
Closed

Unable to preview media assets locally #319

SeraphRoy opened this issue Jan 8, 2023 · 4 comments · Fixed by #324
Assignees
Labels
bug Something isn't working proxy-server
Milestone

Comments

@SeraphRoy
Copy link

I am trying to migrate from NetlifyCMS to StaticJsCMS. I have not deployed my changes but just trying out things locally. It seems like I am unable to preview my media assets locally.

Here's my repo that's already using NetlifyCMS https://github.com/SeraphRoy/SeraphRoy.github.io. All I changed is the admin/index.html to make it use StaticCMS.

Attached the screenshot along with developer console. Seems like it's trying to read the file from the host but since this is localhost is't just not able to read it.

Screen Shot 2023-01-07 at 10 31 41 PM

Screen Shot 2023-01-07 at 10 42 17 PM

I am using https://unpkg.com/@staticcms/app@latest/dist/static-cms-app.js

@SeraphRoy
Copy link
Author

Weirdly enough if I use npx netlify-cms-proxy-server instead of npx @staticcms/proxy-server, preview from media tab still doesn't work (but with a different UI) but it works from the post

Screen Shot 2023-01-07 at 10 44 20 PM

Screen Shot 2023-01-07 at 10 44 57 PM

So something might be wrong with the local server?

@KaneFreeman KaneFreeman self-assigned this Jan 9, 2023
@KaneFreeman KaneFreeman added bug Something isn't working proxy-server labels Jan 9, 2023
@KaneFreeman KaneFreeman added this to the v1.0.0 milestone Jan 9, 2023
@KaneFreeman KaneFreeman moved this to In Progress in Static CMS Jan 9, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Static CMS Jan 10, 2023
@KaneFreeman KaneFreeman reopened this Jan 10, 2023
@KaneFreeman
Copy link
Collaborator

This should now be resolved with beta 11

@shawntax
Copy link

shawntax commented Jan 27, 2023

EDIT: nevermind, I figured it out. I needed to add public_folder to my config:

public_folder: '/media'

Hello! Unfortunately I'm running in to this same issue, with a NextJS 13 app using @staticcms/core: 1.2.4:

Screenshot from 2023-01-27 15-45-28

My config.js for local dev looks like:

 local_backend: true,
 editorial_workflow: false,
 cms_manual_init: true,
 backend: {
    name: 'proxy',
    proxy_url: 'http://localhost:8081/api/v1',
    branch: process?.env?.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF ?? 'main',
  },
 media_folder: 'public/media',

This same exact set-up worked for netlify-cms-proxy-server, so I assume it's something with https://github.com/StaticJsCMS/static-cms-proxy-server/blob/main/src/middlewares/localFs/index.ts?

@KaneFreeman KaneFreeman reopened this Jan 28, 2023
@shawntax
Copy link

@KaneFreeman feel free to set this back to closed -- I updated my comment to reflect it was a config issue on my end.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working proxy-server
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants