Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type number #183
I'm trying to make requests to my firestore database in my lambda function.
I can declare a document reference as follows :
However, I cannot make a
This returns the error message as stated in the title :
I can't tell if the error is netlify related or firebase related.
I understand from this thread (#112) that there may be issues when making firebase requests using netlify-lambda. So, I tried netlify-dev as documented. I set it up (I have a .netlify folder in my server folder). I set the proxy target as
Can we know for sure if the issue comes from netlify or firebase ? Any suggestion what can be done ?
I'm aware of an alternative way of using firebase (as documented here https://firebase.google.com/docs/projects/api/workflow_set-up-and-manage-project#before-you-begin). However, it's in beta and it doesn't work either.
Thanks for your kind help
first of all, can we make sure that you're hitting the right url. the function should be at
to debug, i'd take a look at where that
i've had some success pinging firebase from netlify functions. i think whats happening in some of the other issues is problems bundling Firebase SDK because it includes native C++ modules.
The solution here worked for me, though I am still trying to figure out what my GOOGLE_APPLICATION_CREDENTIALS path variable should be: is it root? lambda folder? ./<path>, /<path>, or just <path>? Or do I set it in netlify.toml? or in my start command in package.json?
Hey I can maybe help here. I just battled a bunch of firebase admin sdk + netlify function errors along the way, primarily because I wasn't too familiar with cloud functions.
For that error you're seeing about the first argument, may I ask what you're returning as the body to the response? It should be a string or if you want a JSON object, JSON.stringy it (or a buffer is allowed also).
Also the firebase app only wants to be initialized one time, so you can do something like this:
and then use it in your function js