question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fromFile not a built-in function in Create in Property, but it exists in Bot Responses

See original GitHub issue

Describe the bug

When I try to ‘Set Property’ and ‘Create Expression’ I add the following using the autocomplete prompts in Composer =json(fromFile(user.path)) Despite the inbuilt prompts I get a warning “Set a property: value fromFile does not have an evaluator, it’s not a built-in function or a custom function.” when adding the property.

If I add a Bot Response template using - ${json(fromFile(user.path))} or when I add this as a dialog response, so the fromFile function obviously exists.

Version

Version: 2.1.0 Electron: 8.2.4 Chrome: 80.0.3987.165 NodeJS: 12.13.0 V8: 8.0.426.27-electron.0

Browser

  • Electron distribution
  • Chrome
  • Safari
  • Firefox
  • Edge

OS

  • macOS
  • Windows
  • Ubuntu

To Reproduce

Steps to reproduce the behavior:

  1. Go to ‘Create’
  2. Click on ‘+ Add > Manage properties > Set a property’
  3. Click to enter the expression ‘=json(fromFile(user.path))’
  4. Problems [Warning] (highlight in Composer): Set a property: value fromFile does not have an evaluator, it’s not a built-in function or a custom function. Please add unknown functions to setting’s customFunctions field.

Expected behavior

I would expect the expression to set the property for the JSON against the assigned user.jsonobject, similar to the way it creates the object in a Bot Response template.

Additional context

Calling the Bot Response template allows me retrieve specific values from the JSON object, but using that method I am not able to pass those into a property - I want to be able to do that to use Collection functions. The JSON I am using will be static so I want to access files in the project instead of calling out to Cosmos DB each time I want to access the data.

When creating the property I have tried a number of combinations including adding as a String and an Object, and using as an expression (using the prompts) and also just pasting in the code ${json(fromFile(user.path))} that works in the Bot Response template and directly as ‘Send a response’.

I can see where to add a custom function, but have no idea what to add for fromFile.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
anusharrcommented, Aug 31, 2021

@azurecloudmatt, confirming that fromfile() is only going to be available in LG, not from expressions used elsewhere. So I will go ahead and change this issue from a bug to a Feature Request.

0reactions
azurecloudmattcommented, Aug 27, 2021

@anusharr, I have been doing some further reading into this, does this document mean that fromFile() is only available in LG? Functions injected from LG - fromFile

Is there a way to add fromFile() to expressions in set a property?

If there is no way to add the LG function to expressions in Composer, can you change this ticket from a Bug to a Feature Request? Remove references of non-available functions from the expression builder part of Composer?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I get the error fromFile not a built-in function in ...
I have upgraded to the latest version of botframework and started to get the error: Oops, it looks like something went wrong. Error:[Error]...
Read more >
Adaptive expressions prebuilt functions in Bot Framework SDK
Learn about the available prebuilt functions in adaptive expressions ordered by their general purpose.
Read more >
Manage the Conversation Context Service
The registerContextNamespace method creates a custom namespace. If the namespace already exists, this method does not create an additional one.
Read more >
gcloud compute instances create
The disks specified must already exist. name: The disk to attach to the instances. When creating more than one instance and using this...
Read more >
Changelog — Python 3.11.1 documentation
Python next: Release date: XXXX-XX-XX Core and Builtins: gh-100374: Fix incorrect ... setting or deleting a property without the corresponding function now ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found