Exposing module dependent code to other scoped apps

AdrianJ26763850
Tera Contributor

Hi!

 

I am incredibly excited by the potential the new SDK and Fluent tooling promises developers in the community. I have mostly been able to work out an ideal workflow developing with TypeScript and Jest unit tests locally while pushing to git and ServiceNow remotely.

 

There are however a few pains I just can't seem to overcome so thus I turn to the forums for help. 

 

1. I have seen it discussed on other posts that importing ES modules in other applications is not possible. You would have to create a script include to expose module functionality elsewhere. That's entirely fine by me as a premise, but I can't seem to make it work. Any time I call functions in a script include containing "require" syntax from a different scope, I am met with this error:   

 

Script execution error: Error Description: "require" is not defined., Script ES Level: 200

 

Are there any examples out there of this actually working?

 

2. I haven't been able to get the Fluent language server to work at all. Not with the vscode extension or in the IDE. Here is an example of an error I get whenever I try to edit now.ts files:

 

[Error - 8:27:05 PM] Server initialization failed.
  Message: Request initialize failed with message: now-file:/%5C9c7f5ee3e0e4433780d0d6ed1d34eb9f
  Code: -32603
[Error - 8:27:05 PM] Fluent Language Server client: couldn't create connection to server.
  Message: Request initialize failed with message: now-file:/%5C9c7f5ee3e0e4433780d0d6ed1d34eb9f
  Code: -32603
 
3. Is it currently not possible to clone repositories from Azure Repos? The IDE refuses to consume any URL from my Azure Repos projects. It simply gives me an "invalid format" error message
 
Thank you so much for your feedback. I think the SDK is a great leap forward for developers in the community and I'm looking forward to seeing it develop further.
1 ACCEPTED SOLUTION

Sean Bell
ServiceNow Employee
ServiceNow Employee

 

Hi Adrian,

 

For the first question, we are planning to add support for cross-scope module access in Zurich. Until then, the script include workaround should work, but we found a bug (PRB1767574) that would sometimes happen when crossing the scope boundary during a script execution. Require would not get defined in the new scope being called into causing the "require is not defined" error. We have pushed the fix up and it should be available in Xanadu Patch 2 and beyond.

 

Sorry for the inconvenience, most of this stuff is in early days and we're still working out the final design and some of the kinks.

 

-Sean

View solution in original post

4 REPLIES 4

EdwinCoronado
ServiceNow Employee
ServiceNow Employee

Hello Adrian!

 

For question 2, are you on a Windows machine by any change?

For question 3, this is coming soon! we are actively working on OAuth support and support for other git providers

It's good to hear that Azure Repos and other providers will be supported in the near future. 

 

As per your reply, I have indeed been working on a windows machine while attempting to get Fluent working.

 

Thanks!

thanks, Adrian. There is a known issue with Fluent in Windows with the 1.0 version. Issue has been fixed in our 1.0.1 release which will be available on September 10th. 

Sean Bell
ServiceNow Employee
ServiceNow Employee

 

Hi Adrian,

 

For the first question, we are planning to add support for cross-scope module access in Zurich. Until then, the script include workaround should work, but we found a bug (PRB1767574) that would sometimes happen when crossing the scope boundary during a script execution. Require would not get defined in the new scope being called into causing the "require is not defined" error. We have pushed the fix up and it should be available in Xanadu Patch 2 and beyond.

 

Sorry for the inconvenience, most of this stuff is in early days and we're still working out the final design and some of the kinks.

 

-Sean