• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CEP 9 Illustrator require SSH2 not working but in photoshop does. Please Help

New Here ,
Nov 02, 2021 Nov 02, 2021

Copy link to clipboard

Copied

Hello, I need help creating a database connection via ssh tunnel. In Photoshop the script is accepted without problems only in Illustrator it has a problem with the following code.

 

const {Client} = cep_node.require('ssh2');

 

Can someone explain me why this is only in Illustrator ?
Thanks in advance.

 

// CS Interface einbinden um Funktionen von Adobe zu nutzen
const csInterface = new CSInterface();

// Benötige Module für Datenbank verbindung über SSH

const mysql = cep_node.require('mysql2');
let connection = null;

// Buttons
const buttonDBConnection = document.querySelector("#buttonDBConnection");
const buttonStart = document.querySelector("#buttonStart");
const buttonReset = document.querySelector("#buttonReset");

// Button Events
buttonDBConnection.addEventListener("click", initSSHConnection);
buttonStart.addEventListener("click", sendToApplication);
buttonReset.addEventListener("click", resetExtension);


function initSSHConnection(){
    // HERE IS THE BUG
    const {Client} = cep_node.require('ssh2'); // <----
    const sshClient = new Client();

    // Datenbank Serverdaten
    const dbServer = {
        host: $('#inputHostname').val(),
        port: $('#inputPort').val(),
        user: $('#inputUsername').val(),
        password: $('#inputPassword').val(),
        database: "tectmtga_matrix"
    }

    // Tunnel Konfiguration
    const tunnelConfig = {
        host: "xxx",
        port: xxx,
        username: "xxx",
        password: "xxx"
    }
    const forwardConfig = {
        srcHost: '127.0.0.1',
        srcPort: 3306,
        dstHost: dbServer.host,
        dstPort: dbServer.port
    };


	
	$('#startInterface').hide();
  	$('#connectionInterface').show();
  	$('#connectionInterfaceMYSQLInfoMessage').html('<p class="text-center"><i class="fa fa-spinner fa-spin"></i> Verbinde zur Datenbank</p>');

	const SSHConnection = new Promise((resolve, reject) => {
		sshClient.on('ready', () => {
			sshClient.forwardOut(
			forwardConfig.srcHost,
			forwardConfig.srcPort,
			forwardConfig.dstHost,
			forwardConfig.dstPort,
			(err, stream) => {
				 if (err) reject(err);
				 const updatedDbServer = {
					 ...dbServer,
					 stream
				};
	
				 connection =  mysql.createConnection(updatedDbServer);
				connection.connect((error) => {
				if (error) {
					$('#connectionInterfaceMYSQLInfoMessage').html('<p class="failed text-center"> <i class="fa fa-times"></i> Verbindung zur Datenbank fehlgeschlagen!</p>');
					reject(error);
				}
				resolve(connection);
				$('#connectionInterfaceMYSQLInfoMessage').html('')
				//$('#connectionInterfaceMYSQLInfoMessage').html('<p class="success text-center"><i class="fa fa-check"></i> Verbindung zur Datenbank aufgebaut!</p>');
				init();
				});
			});
		}).connect(tunnelConfig);
	});
}

 

TOPICS
Bug , Import and export , Scripting , SDK

Views

237

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Valorous Hero ,
Nov 03, 2021 Nov 03, 2021

Copy link to clipboard

Copied

In your photoshop extension, do you have a node_modules folder where ssh is?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 03, 2021 Nov 03, 2021

Copy link to clipboard

Copied

yes I have ssh2 in the node_modules folder.

I get a connection in Photoshop & Aftereffects but not in Illustrator.

It looks like ssh2 is not supported with Illustrator.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 04, 2021 Nov 04, 2021

Copy link to clipboard

Copied

I don't see how it doesn't work in Ai but does in Ps because ssh2 is a node package and there really shouldn't be anything preventing it from working in one app or another because the node is independent of the host application?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 04, 2021 Nov 04, 2021

Copy link to clipboard

Copied

I don't understand why only in AI the ssh client doesn't work.

If I run the following then I get alert message from "mysql2".But I don't get alert message for the {client}. So the script stops at require of ssh2.

 

const mysql = cep_node.require('mysql2');
alert(mysql);
const {Client} = cep_node.require('ssh2');
alert(client);

 

If I run the same code in PS or AE then I get alert message for both alerts.

I have tried this with AI 2019 , 2020 , 2021 but with none of them it works.

I don't know what I'm doing wrong because in PS and AE it works.

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 04, 2021 Nov 04, 2021

Copy link to clipboard

Copied

Ok and you are sure that the ssh2 is inside of the Illustrator extension's node modules yea? I know I asked this already but you didn't say whether you have multiple extensions you are trying this in, or if it's 100% exactly the same exact extension that you are trying in the verious apps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 04, 2021 Nov 04, 2021

Copy link to clipboard

Copied

Yes I am quite sure that in the extension in the folder node_module the ssh2 is present. I use in all applications (PS,AI,AE) the same extension and the same script. Only AI does not work.

 

It is my first extension but so far everything works only AI is buggy 😄

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 04, 2021 Nov 04, 2021

Copy link to clipboard

Copied

LATEST

Well, be it as it may, let's see if someone can find this later and shed more technical light on this because it should work, right? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines