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

Error rendering in Adobe context #1

Closed
rbuikman opened this issue Jun 8, 2020 · 13 comments
Closed

Error rendering in Adobe context #1

rbuikman opened this issue Jun 8, 2020 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@rbuikman
Copy link

rbuikman commented Jun 8, 2020

Dear Bombino developers,

I've started a fresh new plugin created with Bombino (VUE).
In the browser it shows fine (commented the configureWebpack target/node lines in vue.config.js).

After restoring the configureWebpack config, and run the code from Visual Studio Code:
When this panel is opened in InDesign (CEP 9), the panel stays black and there is a message in de CEPHtmlEngine9-IDSN-15.0.3-com.hello-world.panel-renderer.log showing:

undefined:1

SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at eval (webpack-internal:https:///./node_modules/cep-spy/index.js:192:17)
at Module../node_modules/cep-spy/index.js (http:https://localhost:8080/js/chunk-vendors.js:47:1)
at webpack_require (http:https://localhost:8080/js/app.js:854:30)
at fn (http:https://localhost:8080/js/app.js:151:20)
at eval (webpack-internal:https:///./node_modules/cluecumber/index.js:18:24)
at Module../node_modules/cluecumber/index.js (http:https://localhost:8080/js/chunk-vendors.js:59:1)
at webpack_require (http:https://localhost:8080/js/app.js:854:30)
at fn (http:https://localhost:8080/js/app.js:151:20)
at eval (webpack-internal:https:///./node_modules/vuetify-loader/lib/loader.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/HelloWorld.vue?vue&type=script&lang=js&:2:68)

Do you know what is wrong here?

Kind regards,

Rene

@Inventsable
Copy link
Member

Hey there,

Just to confirm, did you restart your localhost between commenting/uncommenting the vue.config.js options? As in canceling your current session then re-running the npm run serve command?

Unfortunately vue.config.js does not have hot reloading and is only read during the cold start of the command, so this may be the issue though I'd wonder why it's pointing at cep-spy in particular. I can test this in the morning for InDesign in particular.

@Inventsable Inventsable self-assigned this Jun 8, 2020
@rbuikman
Copy link
Author

rbuikman commented Jun 8, 2020

Yes, I noticed this behaviour and did restart (a lot ;-))

@rbuikman
Copy link
Author

rbuikman commented Jun 9, 2020

Please note, this happens with MacOS Catalina 10.15.5 and Adobe CC 2019 / 2020.

@rbuikman
Copy link
Author

fyi: it works on Windows 10, InDesign 15.0.3!

@rbuikman
Copy link
Author

rbuikman commented Jun 12, 2020

OK, the problem for MacOS is in the cep-spy/index.js.

Everywhere you use window.cep.fs.readFile, and replaced the 'file:/' part, the Mac path is broken. It requires a starting '/'.

So to make it work on both Windows and Mac, I've added
(navigator.platform.indexOf("Mac") > -1) ? "/" : "" +
on every line that does a ReadFile with the extension folder.

FE:
author: JSON.parse(
window.cep.fs.readFile(((navigator.platform.indexOf("Mac") > -1) ? "/" : "") +
${decodeURI(window.__adobe_cep__.getSystemPath("extension")).replace( /file\:\/{1,}/, "" )}/package.json
).data
).author,

Perhaps better to have a function returning the extension systempath.
And off course there are also other properties containing a path that need a fix.

@Inventsable
Copy link
Member

Hello and sorry for the late reply, I had another user reporting the same thing a few days earlier and I believe this is the same issue:

Inventsable/CEP-Spy#1

I've just made a push to the repo and republished, can you verify with an npm i [email protected] command on one of the templates?

@Inventsable Inventsable added the bug Something isn't working label Jun 13, 2020
@rbuikman
Copy link
Author

No problem. Indeed same issue. I noticed there is a separate cep-spy in the node_modules of the brutalism module ( referenced in cluecumber ). Do you need to update those too?

@rbuikman
Copy link
Author

And on line 377 of the cep-spy index, think you want to define the realSpy before exporting...
const realSpy = window.adobe_cep ? spy : fakeSpy;

@Inventsable
Copy link
Member

Nice catch! That last part was definitely a typo on my end. I could update these and will once we've guaranteed a solution. Would you mind copying the index.js of 1.1.4, then pasting it inside this cluecumber/node_modules/cep-spy/index.js file?

I'm a bit hesitant to push this latest commit to these other dependencies without knowing, otherwise may risk breaking more (especially with sloppy typos).

@Inventsable
Copy link
Member

Just pushed a new commit to fix that typo and republished, btw.

@Inventsable
Copy link
Member

In terms of inner dependencies, these all rely on cep-spy:

  • brutalism
  • starlette
  • cluecumber

The latter two are dependencies within brutalism itself as well. I may go ahead and republish these with the latest commit, should update all with an npm install command afterward

@rbuikman
Copy link
Author

Thanx, for some reason, the window.cep.fs.readFile function does not like the escaping of the spaces when it is returned from the getRealString function. If you leave out the .replace(/\s/g, "\ ") part it works on the Mac (also with spaces in the path).

@Inventsable
Copy link
Member

Hmmm, okay. Can we move this discussion over to the CEP-Spy repo here?

Inventsable/CEP-Spy#1

You two seem to have the same issue, but are reporting different results. There might be a difference of OS versions or use cases, want to find a single solution that works for every one. I'll close this and quote you there if you don't mind, that way we can all tackle it together.

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

2 participants