why does functions.config() return {}? - firebase

I have a firebase functions project. It’s giving me the following error:
TypeError: Cannot read property 'privatekey' of undefined
The error is coming from this line here:
functions.config().blockchain.privatekey
Functions.config() is returning {} <— An empty object.
So my question is: why is it returning {}, and how can I fix it?
I’ve been able to solve similar problems with functions.config() in the past with this:
firebase functions:config:get > .runtimeconfig.json
But this isn’t working this time.
Is it something to do with how firebase init is configured? A node package?
Any help would be very much appreciated.

I had the same issue with the same folder structure and fixed it by changing directory (in PowerShell) into the "functions" folder and then running firebase serve from there.

If anyone gets this error after creating the .runtimeconfig.json
Try checking the encoding of your file. For me it was failing because the file was encoded as UTF-16 LE. I changed it to UTF-8 and it works fine

Related

problem deploying dotnet cloud function GCP

I have a .NET Core 3.1 cloud function (zipped source code on Cloud Storage Bucket), last time I successfully deployed it a month ago. Now I did a minor code change, zipped the source code and wanted to deploy a new version of it I get the following error:
Deployment failure: Build failed: Failed to run /bin/build: runtimeconfig.json does not exist; Error ID: 6b309792
It's really weird, I also tried to deploy the same source code that worked before and got the same error... What's the reason and how to fix it?
EDIT:
I forgot to mention that this function consists of a few projects in the following structure:
src
-my-function
-referenced_solution
--project1
--project2
--project3
To let GCP understand the structure I used GOOGLE_BUILDABLE="./my-function"
After some experimentation I changed var GOOGLE_BUILDABLE to just "my-function" and that fixed the problem. Still strange that it used to work fine with "./my-function"

Uploading manifest file failing

After making some changes in a JSON manifest file, I was trying to update it following the Amazon documentation:
ask smapi update-skill-manifest -g development -s amzn1.ask.skill.xxxx --manifest "skillManifest.json" --debug
I kept getting this error:
The error was not pointing to what the error was but my guess was that it was related to the parameters, but that was strange as I was following the documentation to letter.
I then tried, instead of passing the json file, to cat the content of the file, which would be either:
For Powershell: --manifest "$(type skillmanifest.json)"
For Linux: --manifest "$(cat skillmanifest.json)"
I still kept getting the same error.
Firstly, for debugging and getting a more accurate error, I checked my ASK-CLi version, which was outdated.
After updating ASK to the latest version I was still getting the same error.
At that point it started including an error object, which was saying:
When looking into Parsing error due to invalid body. and INVALID_REQUEST_PARAMETER through the error codes, it just said the body of the request cannot be parsed.
After research and playing around, the problem was the manifest parameter, changing it to "file:FILENAME" solved the issue:
--manifest "file:skillmanifest.json"
The documentation is not stating this but it seems necessary for it to go through.
I hope this helps someone out there avoid spending a full day troubleshooting.

Function load error: Code could not be loaded

When I try to run sudo functions deploy login --trigger-http, I get the following error:
ERROR: Function load error: Code could not be loaded.
ERROR: Does the file exists? Is there a syntax error in your code?
ERROR: Detailed stack trace: module.js:549
But I already have an index.js file in /lib. I don't know if there's a bigger issue than this because I just solved my last issue. Or this could be unrelated. I've been having a hard time gettings functions running locally with debugging:
I found the answer. I had to change directories into the functions folder.
Additional answer to make more clear.
In my case, i'm trying to run my function inside google functions-emulator then this error happen.
But with short solution from #AskYous, i still got a little confuse.
So like #AskYous answer, we have to enter into functions folder, then type like this:
C:\FirebaseFunctionTypescript\functions>functions deploy api --trigger-http
The "api" is our exported functions inside index.ts file.

TypeError: undefined is not an object on Paw app

I installed some new plugin on Paw app (Postman 1 and 2 export, Swagger 2). And since I have this error when I try to make a new export. I tried to uninstall and reinstall only one plugin, and I still have this error.
But before I install some new plugin, I made some export without error.
This is the error I get when I attempt to make an export:
Export Failed
JavaScript Exception: TypeError: undefined is not an object (evaluating 'ds.length') ({
column = 20;
line = 2277;
})
Sorry for the very late follow up. We've been able to reproduce this issue, and release a fix last week.
Please update your Paw extensions by going to the Paw menu > Extensions > Check for Extensions Updates…
This will trigger the updating of all your installed extensions. Then, please try again to export your project, it should be working correctly.

Firebase error: symbolFileMappings:upsert: The uploaded file is not a valid Breakpad Symbol file

I am trying to upload a dSYM file to Firebase using this command:
./Pods/FirebaseCrash/batch-upload -i ./Info.plist -p ./GoogleService-Info.plist ./service-accounts/mtb.json 78*****C-5**4-3***-***C-00*********7
But each time I run this, I get back the following errors
./Pods/FirebaseCrash/upload-sym-util.bash:377: error: symbolFileMappings:upsert: The uploaded file is not a valid Breakpad Symbol file.
./Pods/FirebaseCrash/upload-sym-util.bash:378: note: symbolFileMappings:upsert: The metadata for the symbol file failed to update.
I have tried this link https://groups.google.com/forum/#!msg/firebase-talk/4829Sp1_uKY/IEC_T4-VBAAJ but haven't had any luck as it errors out to
usage: batch-upload [-hv] [-p google-service] [-i info] service-account-file {mach-o file|uuid}
Can someone help me on this one please?
Thanks
Apparently this bug relates to batch-upload script having problems with archives, so you would need to patch it manually.
Try the following:
Change extract_symbols_and_upload "$EXE" "$ARCH" "$BUNDLE" to
extract_symbols_and_upload "$EXE" "$ARCH" "$BUNDLE/$BNDL_PATH"
The dump_syms utility understands dSYM bundles but not archives,
curiously enough. This fix will go out with the next release.
Source

Resources