Why Your Generator App Isn’t Connecting to Adobe Photoshop

by | Oct 30, 2020 | Development | 1 comment

Another week, another roadblock. This time, I ran into difficulty getting Adobe Generator to connect to Adobe Photoshop.

As I am following along with Davide Barranca‘s Native Photoshop Apps video course, I hit a problem in video #14 – Generator Scaffolding. Specifically, the command that he specifies to run within the generator\generator-core directory returns an error.


Attempts Were Made

Here’s the command (I’m using backslashes because Windows):

PS> node --inspect .\app -f ..\plugins -v

And here’s the result as Davide intended:

Debugger listening on ws://127.0.0.1:9229/c584ec40-a419-4659-a444-3d8ed8736f1a
For help, see: https://nodejs.org/en/docs/inspector
Generator did not receive a log location via 'photoshopLogPath' param; may use a non-standard location
(node:29920) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[info:core 09:46:54.894 C:\Users\christopher.mcgee\dev\projects\js-ps-app\generator\generator-core\lib\generator.js:114:22] Launching with config:
{}
[info:core 09:46:55.058 C:\Users\christopher.mcgee\dev\projects\js-ps-app\generator\generator-core\lib\generator.js:237:30] Detected Photoshop version: 22.0.0
[info:core 09:46:55.066 C:\Users\christopher.mcgee\dev\projects\js-ps-app\generator\generator-core\lib\generator.js:1926:26] Loading plugin: generator-starter (v1.0.0) from: C:\Users\christopher.mcgee\dev\projects\js-ps-app\generator\plugins\generator-starter
initializing with config {}
[info:core 09:46:55.069 C:\Users\christopher.mcgee\dev\projects\js-ps-app\generator\generator-core\lib\generator.js:1942:26] Plugin loaded: generator-starter
Menu created generator-starter

Note the “Detected Photoshop version” on line 7. This means communication was successful. However, when I attempt to run the command, the output is considerably less favorable:

Debugger listening on ws://127.0.0.1:9229/5523fefc-23d7-4d8e-90dd-b7cb84f2070d
For help, see: https://nodejs.org/en/docs/inspector
Generator did not receive a log location via 'photoshopLogPath' param; may use a non-standard location
(node:8052) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[info:core 09:44:39.412 C:\Users\christopher.mcgee\dev\projects\js-ps-app\generator\generator-core\lib\generator.js:114:22] Launching with config:
{}
[warning:core 09:44:39.427 C:\Users\christopher.mcgee\dev\projects\js-ps-app\generator\generator-core\lib\generator.js:133:30] Photoshop error Socket error: Error: write ECONNABORTED
[info:core 09:44:39.429 C:\Users\christopher.mcgee\dev\projects\js-ps-app\generator\generator-core\lib\generator.js:128:30] Photoshop connection closed
[error:app 09:44:40.445 C:\Users\christopher.mcgee\dev\projects\js-ps-app\generator\generator-core\app.js:141:17] Exiting with code 0: Generator close event

On line 7 of this output, you can see that Generator just couldn’t connect to Photoshop. This stumped me for a good long while. And sometimes the error output would be ECONNRESET, reporting a Communication Error: 1. I didn’t know where to go from here, so I even posted to the Generator repo, looking for help.


Changing Course

Some time later, since I wasn’t getting any responses on my post, I decided to try a different tack. What if I followed Generator’s own tutorial on how to get it running?

So I went to the repo’s wiki and followed their Development Environment Setup guide. I immediately noticed three steps—well, four, actually, but the fourth is just “restart Photoshop”—that I never knew about because Davide never mentioned them in his video #14 on Generator scaffolding. He briefly showed this dialog in the previous video—#13, on communication concepts—but never mentions the key takeaways from it. I point them out specifically below.

The Preferences dialog in Adobe Photoshop can be accessed with Ctrl+K in Windows

The first was to make sure to un-check “Enable Generator” in Preferences -> Plug-Ins. This step is probably not 100% necessary, as it only disabled the built-in Generate Assets script. It seems to be necessary only for following the tutorial because the tutorial creates another Generate Assets menu item and it doesn’t want Photoshop getting confused and try to run both of them when one of them is activated.

The second is to make sure to check “Enable Remote Connections” because, obviously, we want the external application to remotely connect to Photoshop. “Remote connection” in this case just means “connected to Photoshop from outside Photoshop.”

Finally—and this is the most important part—set the “Password” to “password”.

I made the mistake of setting the password to something else, thinking that I would be able to specify what that password is in the Generator-enabled app somewhere. Well, if there is a way for me to set it (outside of the library files, which you should never alter), I do not know how. Instead, it’s best to just set the Password to “password”. I don’t think Photoshop is open to being connected to from the internet, but any OpSec readers out there can correct me.

I discovered this by looking searching through the library files and discovered at least two locations where “password” is defined as the default Password:

Shows the default settings for connecting to Photoshop in app.js
The default settings for connecting to Photoshop in app.js
Shows the default password as a constant in lib\photoshop.js.
Default password as a constant in lib\photoshop.js

Sure enough, after setting the password under Photoshop’s “Enable Remote Connections” setting back to its default of “password” and restarting Photoshop, I was able to get Davide’s starter script working and finish Lesson #14.


Conclusion

Until I discover a way to set my own password (if it’s even necessary to do so) with Adobe Generator, then the best thing to do is just leave the default password as “password”. Turning on “Enable Remote Connections” is a no-brainer and disabling the built-in “Generator” (a.k.a. “Generate Assets”) is probably unnecessary, but that password must be set to “password”.

One last thing that the tutorial recommends: Use absolute paths. Evidently, there is a bug currently (as of the writing of this article) that causes relative paths to throw an error. Thankfully, I have not run into this bug myself and relative paths appear to work fine. However, if you happen to run into this issue, use absolute paths.

Related Posts:

1 Comment

  1. filmi full izle

    Great post. I will be facing many of these issues as well.. Erinna Cole Caneghem

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *