In the tutorial. I'm focusing on the "Build your first App with Dialogflow". I'm at "Build Fulfillment" step and downloading node.js. I'm currently waiting for my company to approve the install of this software but want to continue on with my tutorial. I figured I'd be able to copy the package.json and index.js code that is provided and use the Inline Editor, however when I try and deploy I get the following error
"The deployment of your Cloud Function failed:
Function load error: Node.js module defined by file index.js is expected to export function named dialogflowFirebaseFulfillment"
What am I missing here?
Side question: Do I have to use node.js or can I use another IDE to develop?
First of all - you can use any language and platform you want to build your Action. However, only a node.js library is provided by Google. If you want to use a different language, there are a few third-party libraries available, or you can just parse and generate the JSON yourself.
As far as the Dialogflow inline editor, it assumes there is a function exported with the name dialogflowFirebaseFulfillment that will be called. The example tutorial has that with the name sillyNameMaker in a line that looks like this:
exports.sillyNameMaker = functions.https.onRequest((request, response) => {
This is how Firebase Cloud Functions determines which function to call and the URL path for HTTPS calls. You should be able to change this to something like
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
Related
I am a little confused by the new configuration file netlify.yaml.
I imagined it would be a drop-in replacement for netlify.toml, but without the toml file I get the following error:
No netlify.toml found. This is needed to configure the function settings. For more info: https://github.com/netlify/netlify-lambda#installation
When both of them are present I have
failed during stage 'Reading and parsing configuration files': Multiple potential Netlify configuration files in "/opt/build/repo": netlify.toml, netlify.yaml
I would like to access the “plugins” functionality and I am not certain if it exists on the toml version of the configuration as this doesn’t seem to trigger anything:
[[plugins]]
type = "./.netlify/plugins/xxx"
What would you recommend as the best course of action?
Here is the response I have received on the community forum (https://community.netlify.com/t/netlify-toml-vs-netlify-yaml/6482/2):
We haven’t quite finished implementing the json and yml support, but these are the docs: https://docs.netlify.com/configure-builds/file-based-configuration/#json-and-yaml-configuration-files .
It is definitely not implemented in the private beta for build plugins yet, so you’ll need to stick with toml as the docs advise.
Below are the two error (image) I’m facing
I’m using Ionic 4.
everything works but as soon I start calling WooCommerce API and use it in constructor I get the below two errors.
I have imported Woocommerce API, but when I initialize it in constructr it shows both of this error.
It looks like you are using this package which has an obsolete warning:
2019-07-29: This client is obsolete and will no longer receive updates, a new JavaScript library is available under the name of #woocommerce/woocommerce-rest-api.
However, that's a node.js package. It's failing because fs stands for filesystem and that doesn't exist in the browser.
Node.js is for local development, not for browser packages, which is what Ionic 4 is built with.
However, if you really want to use it then this guide will show you how to wrap it up using browserify:
Transforming a Node.js Module to A Browser Library
The solution is to use Browserify to bundle the module with all its dependencies inside one JavaScript file so we will not need any external Node.js dependencies which are not available inside the Cordova webview (a headless browser) used by Ionic 4.
https://www.techiediaries.com/woocommerce-ionic-2/
I don't know how far you'll get as it's for Ionic 2 but I'm just showing you this to demonstrate that node.js packages are not for Ionic.
Update
Based on your comments you say you are having problems with global not being defined.
Searching Google this seems to be a solved issue, try:
I think for now the best option would be to include
(window as any).global = window;
In your polyfills.ts file, as mentioned here:
angular/angular-cli#9827 (comment)
You have to go to folder \node_modules\#angular-devkit\build-angular\src\angular-cli-files\models\webpack-configs\browser.js and replace node: false, by node: { crypto: true, stream: true, fs: "empty", net: "empty", tls: "empty" },
It's working for me.
Our code building process is done via an http server which starts the build process after receiving a project uuid from the build command. Once the server starts the compilation, GCC compatible output can be fetched from it.
Note: only my extension is aware of the project uuid which is different per workspace.
AFAIU I can implement it by:
programmatically adding a task which will call a script with the correct workspace uuid. Is this possible?
Having my extension manage the build process. This seems to be far from supported.
Bottom line, I'm trying to avoid asking the user to add anything to the configuration files and I want to completely manage the build process.
Thanks!
As I didn't find a suitable only vscode solution I did the following:
Defined a helper script which I executed as the task. The helper script was respojnsible for the communication against the HTTP server.
I registered the task using vscode.workspace.registerTaskProvider API, and made sure to register it only after figuring out the UUID.
Then in the task itself I executed the helper script.
(A nice task register example can be found here: https://github.com/Microsoft/vscode-extension-samples/tree/master/task-provider-sample)
Was previously using TFS2013 and XAML-based builds. Had created a number of custom tasks for the XAML builds in C#, including one to set the build number programmatically through the TFS .NET Client API libraries (not the REST API). Have now moved to TFS2015 and trying to move to vNext-based builds. Trying to convert our C#-based customizations to the new build process by re-coding as PowerShell scripts. I am trying to use the following script to programmatically set the build number (as we did previously via C#):
# Step 1: load the TFS assemblies
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Build.Common")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Build.Client")
# Step 2: get the collection
$collection=[Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)
# Step 3: get the build server
$buildServer=$collection.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer])
# Step 4: get the details for the currently running build
$buildDetail = $buildServer.GetBuild($env:BUILD_BUILDURI)
# Step 5: update the build number
$buildDetail.BuildNumber = "1.2.3.4-MyBuild"
# Step 6: save the changes to the build details
$buildDetail.Save()
Everything seems to work just fine until step 6, when I try and save the change made to the buildDetail.BuildNumber. When the "Save()" method is called, the following error is generated:
Exception calling "Save" with "0" argument(s): "TF215070: The build URI vstfs:///Build/Build/40177 is not valid. Make sure that this build exists and has not been deleted.
As best I can tell, step 4 is returning an instance that implements the Microsoft.TeamFoundation.Build.Client.IBuildDetail interface (as I expected it would). Also, clearly the build URI is valid as it is specifically used to load the build information in that same step. Again, this logic mimics the same logic we use in our C#-based XAML customizations, just rewritten under PowerShell.
Searching the internet, I can find nothing related to this error and cannot figure out why I would be receiving it. I did find a (much more complex) version of what I am trying to do here: https://github.com/voice4net/build-scripts/blob/master/ApplyVersionFromSourceControl.ps1. While I haven't tried using this script directly, it appears to be doing basically the same thing and, presumably, worked for its author.
Is there anyone out there that can help me to understand this error, why I am getting it, and, ideally, how to fix it?
SIDE NOTE: This is not Microsoft's hosted TFS; this is a traditional TFS system that our company has installed internally.
It seems like you are trying to use the incorrect API to update your build number. You should be using the WebAPI/REST portion of the client DLLs.
That said I highly suggest you create a custom task in pure PowerShell or TypeScript in order to achieve your goal.
Here is an example of how to do so in TypeScript:
console.log(`##vso[build.updatebuildnumber]${newBuildNumber}`);
or in PowerShell:
Write-VstsUpdateBuildNumber -Value $newBuildNumber
You can check the reference here on how to create build tasks:
https://github.com/Microsoft/vsts-task-lib
The methods in the TFS SOAP object model (such as Microsoft.TeamFoundation.Build.Common) only apply to the XAML build system. You're targeting the wrong build system, which is why you're having problems.
Use the appropriate object model (either the REST APIs directly, or the C# REST API wrappers).
I've used Yeoman to make a quick project skeleton using the yo webapp generator command. In the resulting Gruntfile I see that it's setup to compile CoffeeScript but it seems like its just sticking compiled files in a tmp folder.
coffee: {
dist: {
files: {
'.tmp/scripts/coffee.js': '<%= yeoman.app %>/scripts/*.coffee'
}
},
},
How do these get included in the project during development. I'm not using RequireJS.
The yeoman docs are unclear on how to use coffeescript. They only mention that it gets automatically compiled.
Using yeomen 1.0.0-rc1.4. I use:
$ yo angular --coffee
The resulting project has controller and app scripts in CoffeeScript.
grunt configuration file remains in js (what is not really a problem).
Running
$ grunt test
runs tests and all seems fine.
$ grunt server
is also doing what one expects (build the app, test it, starts server, opens the app in web browser and starts watching for changes, so if I change a coffee script file, it is quickly reflected in the web broser.
Documentation also states, one can use yo to add particular pieces like
angular:controller
angular:directive
angular:filter
angular:route
angular:service
angular:decorator
angular:view
each can be called with a --coffee switch and get the script in CoffeeScript, e.g.:
yo angular:controller user --coffee
I just found an issue in the github repo referencing this problem. https://github.com/yeoman/generator-webapp/issues/12
It offers a temporary solution: https://github.com/yeoman/generator-webapp/issues/12#issuecomment-13731929