Why am I getting SyntaxErrors when trying to send customized Slack messages from GCP pub / sub?

This topic was automatically generated from Slack. You can find the original thread here.

Hey folks im experiencing some issues with Slack messages (GCP pub / sub → slack).

My message should look something like this

🚨 **Stripe Webhook Timeout** 🚨

Function `stripeWebhooks` timed out during execution. 

**Execution ID:** `{{steps.trigger.event.labels.execution_id}}

But I get this error:

SyntaxError
Unexpected identifier 'stripeWebhooks'

Then I tried to change it to this

🚨 **Stripe Webhook Timeout** 🚨

**Execution ID:** `{{steps.trigger.event.labels.execution_id}}

and I get this error

SyntaxError
Unexpected identifier '$'

Then I tried to test just this:

{{steps.trigger.event.labels.execution_id}}

(note: without the backticks)

And it :white_check_mark: correctly sends the exectution id in slack message.

Would really love some help getting this sorted out. I might be doing something obviously wrong lol, but I’ve been stuck on this for quite some time now

oh, an update

seems like its purely an issue with how you guys handle backticks.

this works without any backticks at all

🚨 **Stripe Webhook Timeout** 🚨

Function stripeWebhooks timed out during execution. 

**Execution ID:** {{steps.trigger.event.labels.execution_id}}

Another update,

seems like I can escape the backticks and it shows up as expected in slack

i.e. change

Function `stripeWebhooks` timed out during execution. 

To

Function \`stripeWebhooks\` timed out during execution. 

yeah… escaping the backticks actually solves my question. Lol no need for help anymore. :face_palm: but idk if this is expected behaviour on your guyses end. Probably not. Seems like the backticks somehow run some actual code somewhere lol - might be a security issue not sure

can you read the thread above and help?

I’m sorry, but I don’t have access to the thread you’re referring to. If you could provide more details or context about the issue you’re facing, I’d be happy to help. If you need further assistance, you can also visit Support - Pipedream for more support options.

this is the thread:

Hey folks im experiencing some issues with Slack messages (GCP pub / sub → slack).

My message should look something like this

🚨 **Stripe Webhook Timeout** 🚨

Function `stripeWebhooks` timed out during execution. 

**Execution ID:** `{{steps.trigger.event.labels.execution_id}}

But I get this error:

SyntaxError
Unexpected identifier 'stripeWebhooks'

Then I tried to change it to this

🚨 **Stripe Webhook Timeout** 🚨

**Execution ID:** `{{steps.trigger.event.labels.execution_id}}

and I get this error

SyntaxError
Unexpected identifier '$'

Then I tried to test just this:

{{steps.trigger.event.labels.execution_id}}

(note: without the backticks)
And it :white_check_mark: correctly sends the exectution id in slack message.

Would really love some help getting this sorted out. I might be doing something obviously wrong lol, but I’ve been stuck on this for quite some time now

oh, an update

seems like its purely an issue with how you guys handle backticks.

this works without any backticks at all

🚨 **Stripe Webhook Timeout** 🚨

Function stripeWebhooks timed out during execution. 

**Execution ID:** {{steps.trigger.event.labels.execution_id}}

[4:34 PM]
Another update,

seems like I can escape the backticks and it shows up as expected in slack

i.e. change

Function `stripeWebhooks` timed out during execution. 

To

Function \`stripeWebhooks\` timed out during execution. 

[4:38 PM]
yeah… escaping the backticks actually solves my question. Lol no need for help anymore. :face_palm: but idk if this is expected behaviour on your guyses end. Probably not. Seems like the backticks somehow run some actual code somewhere lol - might be a security issue not sure

It seems like you’ve resolved the issue by escaping the backticks in your Slack message. This behavior is indeed related to how backticks are interpreted in certain contexts, as they can be used for code execution or formatting, depending on the environment. In your case, when sending messages to Slack via Pipedream, the backticks were likely being interpreted in a way that caused syntax errors. By escaping them with a backslash (\), you effectively treat them as literal characters, preventing any unintended interpretation or execution. Here’s a summary of the solution: - Use backslashes to escape backticks in your message content when sending to Slack: ```
plaintext Function `stripeWebhooks` timed out during execution.

can you run code using a backtick? If so, what kind of code can I run

You can run code in Pipedream using code steps, but not directly using backticks like you might in a Markdown document. In Pipedream, you can add a code step to your workflow to execute custom logic. Here’s how you can do it: 1. Add a Code Step: Click the + button below any step of your workflow and select the option to Run custom code. 2. Choose a Language: Pipedream supports multiple programming languages for code steps, including Node.js, Python, Go, and Bash. You can choose the language that best fits your needs. 3. Write Your Code: Once you select the language, you can write your code in the editor that appears. For example, in Node.js, you might write: ```
export default defineComponent({ async run({ steps, $ }) { console.log(“This is Node.js code”); $.export(“test”, “Some test data”); return “Test data”; }, });

so is it a bug then that a backtick seems to be interpreted to run code?

It seems like you’re experiencing an issue where a backtick is interpreted as running code. In many programming environments, backticks are used to denote code blocks or inline code, which might be why you’re seeing this behavior. However, if this is happening in a context where it shouldn’t, it could be a bug or a misconfiguration. If you’re using Pipedream and encountering unexpected behavior with backticks, I recommend checking the documentation or reaching out to Pipedream support for further assistance. You can visit Support - Pipedream for more support options.

Ah I think I know what it is, but let me check to make sure

{{ }} will actually execute JavaScript code itself.

Backticks, like apostrophes are signal to JavaScript that this begins or ends a string.

So most likely you’re ending a wrapping backtick under the hood.

Yea I think that’s what happened too

yeah gotcha, escaping it works as mentioned above. But it feels like sql injection-esque territory :laughing: :skull: not sure if this is intended

Each workflow execution runs in an isolated environment so just be careful what you’re inputting in the prop configuration