The snippet will only work if the ejs file has .text.html.js in its grammar scope.
You can check the scope of ejs by opening your index.ejs file and pressing Ctrl+Shift+Alt+P. You’ll get a notification that shows the scope (as well as the other scopes of the word at your cursor):
I don’t know what scope ejs uses, but I’d first verify that .text.html.js is actually correct.
Once you have verified or corrected the scope, the snippet should work. If it still does not work, it could be you are accidentally defining snippets for the same scope multiple times, in which case only the last one will activate. See this topic for more information: