Emulate Firebase functions with latest version of functions - google-cloud-functions

I'm currently developing Firebase functions using the Firebase emulators locally.
Every time I'm changing the logic in my functions, I want to simply run
firebase emulators:start
But it seems the latest changes are never included unless I first deploy the functions using
firebase deploy --only functions
This causes unnecessary deploys of unfinished code and adds a lot of time between testing each iteration.
Is there any way I can ensure the latest version of my functions are included when only running the emulators without running deploy? I've been scouring the documentation and couldn't find anything pointing me in the right direction.

So after snooping around a bit it seems that my functions written in Typescript are not compiled to javascript when only starting the emulators. The javascript in functions/lib/**.js is run, but since the Typescript is not compiled it will always run the previous version.
This seems like a bug on Firebase's side. The natural expectation when creating a firebase folder using Firebase-cli and running emulators from the root directory would be for the Typescript to be compiled.
I've sent a bug ticket to Google Firebase and will close this question. A work around is to create a script that runs tsc before firebase emulators:start.

I found in my package.json there's one of script named build, almost sure it's part of the firebase setup so everyone should have it too.
So just go to the functions folder and execute: "npm run build".

Related

Apparent bug with the --inspect-functions flag

Based on some quick searching, it doesn't look like this issue has been reported yet.
This occurs when locally testing in a firebase functions project with two or more http functions defined for different paths, when supplying the --inspect-functions flag in this command:
firebase emulators:start --only functions --inspect-functions
After a function is called for the first time, the mapping of http paths to functions is broken. Every subsequent call to any function path will be routed to the first function that was called, rather than the one that corresponds to that path.
Minimal code to reproduce: https://github.com/johnang3/functions-emulator-bug-demo
This occurs when using version 10.2.1 of the firebase CLI with firebase-functions versions 3.13.2 and 3.18.1. I have not tested any other versions.
It seems that you are using an outdated version of firebase-tools.
I've tried running the command below under the functions directory, then tried running the browsers found in your Github, and it works fine on my end.
npm install -g firebase-tools

Firebase Cloud Functions - Error: Functions did not deploy properly. - Provided module can't be loaded

today I had the following after running the command firebase functions deploy --only functions.
After much research, I found the command firebase functions:log
This showed me the "correct" error.
Provided module can't be loaded. Did you list all required modules in
the package.json dependencies?
The solution to my specific problems was:
remove node_modules folder
npm install in functions folder
In my case, After a long time of searching, I found the reason to be that I had disabled billing for the project for some time.
It now worked fine after I enabled it in the Google cloud console.
It would have been really helpful if firebase could show any useful error message to suggest the problem. I found this after many trials.

How do I run the Web3J Smart Contract example?

I'm trying to run the Web3j example available at https://github.com/web3j/sample-project-gradle
Unfortunately, there is hardly any information available on how to build and run the example, and newbies have to contend with learning Gradle in addition to the Web3j-Java interface.
I'm able to build the example (after creating a Wallet account with a JSON file, loading it with Rinkleby Ether and inserting my Infura API key into the Application file) as follows:
$ gradle build
which succeeds without errors. However, I am clueless on how to run the project...thanks in advance for any help.
s1b
Everything seems ok with the your project. Have you tried "Run as a Java application" option from the Eclipse IDE? I am running my Java smart contract functions in this way.

Can't get Lazarus to do.....anything?

So I thought I would install Lazarus/Free pascal -latest version from the sourceforge website.
Downloaded the win32 version and install on my XP machine couple of nights ago.
Problem is, it can't seem to find any of its own files.
From the first and every subsequent run it comes up with an error which says it can't find its system.ppu file relating to win32.
I just ignore that error and it seems to still run.
I tried to make a simple calculator application and it couldn't even seem to find the system files or files in the project directory. After battling these problems and setting every single path I could find in all the setups to every directory I could find it eventually compiled and run the program - once, not been able to make it do it again.
I also tried to make a user component library following the instructions on the web and that won't work either because, you guessed it, it can't the files. This time it gives an error saying it can't find a Ttreeview component, despite not even using that component in the library.
Being able to follow search paths is pretty fundamental stuff that they don't seem to have mastered.
Anybody managed to get a working system going, or any tips to sort these problems out?
Did you install in the default directory c:\lazarus? I thought there was an issue with installing to another directory, especially if the path contains spaces.
Nine times out of ten, its the old config of an earlier Lazarus attempt, that still lingers somewhere in the "local app" part of the profile.
If nothing else helps uninstall Lazarus, download Lazarus CodeTyphon edition, and run install as admin.

Hudson build fails when run in browser but works from command line

I am setting up a new Hudson task (on WinXP) for a project which generates javascript files, and performs xslt transformations as part of the build process.
The ant build is failing on the XSL transformations when run from Hudson, but works fine when the same build on the same codebase (ie in Hudson's workspace) is run from the command line.
The failure message is:
line 208: Variable 'screen' is multiply defined in the same scope.
I have tried configuring Hudson to use both ant directly and to use a batch script - both fail in Hudson.
I have tried in Firefox, IE6 and Chrome and have seen the same issue.
Can anyone suggest how we can workaround this problem with Hudson?
Problem solved.
Our build is actually dependent on jdk 1.4.2, and Hudson appears to run using 1.6. When I set Hudson to run as a service, it ran as my local user, which meant that it picked up the 1.4.2 JAVA_HOME environment variable - and therefore worked.
I guess another possible solution is to configure Hudson to use 1.4.2 by default.
I would assume this is not an issue with Hudson directly, as it is with the build script and/or the environment itself.
Is your build script relying on certain environment variables being defined, or worse, the job running from within a certain directory structure (i.e. it works if it's run from under /home/mash/blah but not from under another directory like /tmp)? Is the build script making reference to external files by relative paths?
These are the things I would look into. For environment variables, you can tell Hudson to pass these into Ant. For the other issues, you probably want to change your build script. Check the console output provided by Hudson, and maybe set Ant to print verbose/debug messages to get a better idea about the environment/filepaths.