Output link when "deploying functions" for Firebase looks nothing like the github example - node.js

quick question.
I've been going through the google actions tutorials and sdk and quickly went through their github located at:
https://github.com/actions-on-google/dialogflow-webhook-template-nodejs
I followed the steps to initialize my firebase client and put in the addMessage and makeUppercase functions. Per the next step I did a firebase deploy --only functions, but this is where it gets weird.
In the sdk read.me it says it should output a link that looks similar to:
https://${REGION}-${PROJECT}.cloudfunctions.net/yourAction
However the link that terminal spit out for me was a link to my function "console" and the link looked like:
https://console.firebase.google.com/project/"my project name"/overview
I'm curious where I went wrong here as I simply copy and pasted the functions step by step and then deployed as they said.
Is this just how firebase returns the functions now? Maybe there was an update since the node.js sdk was published the other month? I'm worried that this outputted link is not the correct one for my webhooke in dialogflow. When I go to my console link, I can't find anywhere that gives me a link for a webhook within that dashboard so I'm a bit confused here
EDIT: So I dug deeper in their resource page, it's telling me it should output both my Project Console link as it did above as well as the function link. The function link is not being shown, which is leading to my confusion. Any idea as to why the function link is not being created?

The Firebase command line tool has changed something recently, so it only reports that URL the first time a function gets deployed. Or something like that.
The canonical way to get the URL for your function is to
Go to the Firebase Console (https://console.firebase.google.com/)
Login and select your project, if necessary.
Click on the "Functions" menu item on the left, which may be grouped under the "Develop" section.
In the center area, you'll see the function you have deployed for that project, along with the URL for it.

I went and deleted everything and tried again, now the function url is showing when I deployed my functions. I think what had happened before is I had ran an npm init on my folder out of habit before doing my firebase stuff, and when using firebase functions it will build the node dependencies for you as part of the process. I think running this early npm init screwed something up and was causing my firebase commands to act weird.

Related

Why is my code not updating on App Engine?

I have an App Engine Service, running on Google Cloud Platform.
I run an old version of my NodeJS application on it.
After having updated my code, I have run the following command: gcloud app deploy, in my GCP console, directly. It shows no error.
It says 'X files updated' and after that, I go on my application and the code is actually not updated.
I expect my code to be deployed and therefore, updated, after I run this command.
Why is this expectation not met?
Are you sure you are deploying to the same version? If you're deploying a different version, did you migrate traffic to this new version? To check this, login to console.cloud.google.com > App Engine > Versions
This will show you all the versions you currently have deployed and you can confirm which one(s) are serving traffic
You should also confirm that you actually have the 'updated' source code deployed. Following the link in bullet 1 above, you should see a column that says 'Diagnose' with 'TOOLS' under it. Click on the drop down and select 'source'. This will show you your source code. Confirm you have your updated code
If your files are static, they could be cached. You can try using cache bursting techniques (search Stackoverflow for this), or wait for some time and try again.

Azure Durable Functions - HTTP Starter Install

I have been following the Microsoft azure developers online course and i have started an exercise on durable functions
First thing i had to do was to use Kudu to install the durable functions package via a package.json file
all details are in this link
https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-create-portal
After this i had to create a new HTTP start function (details also in the above link) but the install does not complete successfully (see attached screen shot)
I have tried this a few times and no joy and unable to continue the course until i get this resolved
screen shot shows the errors and no matter how long i leave it it never completes
have also tried restarting the function and try again but no luck
screen shot - error installing HTTP start
ok i have now overcome this
Details of the fix are in this link
https://github.com/Azure/azure-functions-host/wiki/Updating-your-function-app-extensions
its important to stop the function otherwise you don't see the bin folder and the .csproj file you need to edit

Deploying an Azure Function from VS Code - Succesfull but not visible in the Portal

I created a function and I am trying to deploy it from VS Code by clicking the Deploy to Function App.... The Deployment runs successfully based on the output log - Deployment successful but then when I go to the portal, the function is not listed under Functions.
What shall I do and what is the problem here?
When I debug in VS Code, I get this: No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
Unfortunatly I would not know if those steps don't work for uploading. The deployment finishes, and every single time it becomes visible in my portal. Uh, maybe there is a slight difference. The app service itself is pre-created via terraform. Just the uploading of the code I do via VSC.
As far as deletion goes:
Open the resource group, in the list lookup the App Service. Select the checkbox in front of it. Delete in the top nav bar of that pane.
Trying to delete it any other way will indeed give you the "Not found" error.
I've had the same 'issue', in my case it turns out that the issue was a bad entry in the requirements.txt
I had an incorrect line with 'io' and when it was present despite the deployment appearing to complete successfully in VS code, the function was not updated if it was previously deployed or not deployed if it wasn't resulting in the same 'no results' in the functions list.
Having other requirements such as 'numpy' or 'scipy' worked just fine.
It's an old thread but maybe it'll be helpful to whoever gets here in the future.
Even as of now, some changes I make in VS Code seem to take time to be immediately visible on the portal. I had a similar issue with resources, i.e. creating a resource from VS Code wouldn't make it immediately visible on Azure Portal. You can always go to Functions on the portal and click Refresh. Also try going to Advanced Tools, then Kudu and checking if your function can be found there.
One word of advice: if you publish your functions from VS Code, then work on that resource only from VS Code. You will find it reiterated all over Azure Functions docs that:
Publishing to an existing function app overwrites the content of that
app in Azure.

Get code from firebase console which I deployed earlier

I had created firebase functions in nodejs and deployed the code on firebase.
The function was to send an email when the new user is created.
I have lost the code now. Can we pull that code from firebase ?
Note: the process below may work or not for your case. Don't rely on it as a replacement for keeping your code in a proper version control system.
You can retrieve the code for your Cloud Functions from the Cloud Console.
Go to this URL
Select the project that the function is in
Select a function from the list
You will get to this page:
Select the Source at the top
Click the "Source location" link
A zip file with the latest source of your function will start to download.
Note that these files may periodically get deleted. In that case, the above process will not work to recover your source code.
In the firebase console in the left hand menu select Functions. Hover over the function you want to view and click the three vertical dots. Select Detailed Usage Stats. This will bring you to the Google Cloud console. Select 'Source' to get the source code.
When you click to select your project, make sure you have the right organization selected.
The google cloud console link didn't work for me (might have been outdated)
Updated
Go to https://console.cloud.google.com/
Select your project [1]
Go to https://console.cloud.google.com/functions/list
Under Actions (with the 3 dots), click Test Function [2]
Go to Source, and you will be able to see your entire deployed project functions [3]
After downloading the source using the method of the selected answer, you need to perform the following tasks to be able to create/edit functions.
Create a new folder. eg, myFunctions.
cd into myFunctions.
run firebase init.
Follow the onscreen instructions. Be sure to select "Cloud Functions" in the list of firebase features to initialise. Also be sure to choose existing project & choose your project.
After npm finishes, a functions folder will be created in myFunctions.
Delete the functions folder.
Copy the functions folder that you downloaded initially.
That should be the trick!
It looks like that the answers given above are outdated and do not work anymore. This is the latest and most robust thalaiva way of accomplishing the task assigned to you in this tight deadline.
Goto https://console.cloud.google.com/storage/
Choose the bucket staging.<project-name>.appspot.com
Click on firebase-functions-source file.
The zipped folder of your firebase functions will get downloaded
Cheers!

Unable to publish node js site to azure using Visual Studio 2013

I am publishing my node js site to azure using this tutorial - http://blogs.technet.com/b/sams_blog/archive/2014/11/14/azure-websites-deploy-node-js-website-using-visual-studio.aspx
I get the following error, as mentioned in one of the comments on the blog, any idea what this error is about and how do I fix this ? I am able to run my app locally no issues with that.
Error: InvalidParameter
Parameter name: index
P.s : the site is like a very basic "Hello world" kind of site, this is the first time I am using and deploying to azure too.
I created a new project as a "Blank Azure Node.js web application", and replaced the resulting package.json and .js files with what I had before, and it publishes fine now
All was working fine for and suddenly got the error! I pretty sure it something in the project as it's now happening on vs2013 and vs2015 on different computers.
Its something to do with Templates after a lot of searching. For me Azure TFS CI got things working again if possible for you?
I had this issue with some projects but not with others, all created in a similar way. So I went thought every change and every setting I could until eventually i worked it out. I didn't want to give up and just remake them.
Basically its file paths, the first thing you notice is that it errors very quickly compared to a usual publish, the first thing that is triggered is a build but unlike heavy framework languages there not really much to actually build.
Like all builds for VS it pops out a bin folder take not of where this appears. This is the key, you want this to appear in the root of your deployment usually at the same level as the publish profile.
Before I moved my projects to VS, TFS and Azure, I used to use git and used the azure push and deployment as part of git, so I instinctively structured my folders in the similar fashion with src folder and all the extra VS baggage in the a directory higher.
This is where I noticed bin folder, so re-structured my solution and made changes to .njsproj (notepad) and moved to be inline with source code and re-added it yo my solution.
Technically speaking this a bug within VS as it allows to create the project and specify different locations which is all fine unless you want to build and publish locally.
Once you get your head around what is going on you should be able to solve this problem easily and not make the same mistake in the future. If anyone is still confused comment and ill grab some screen shots.

Resources