Replies: 2 comments
-
It gives you an error right in there. I think params is more for things like headers - and note the error tells you it needs a Content-Length header included. This might be something we should fix internally, but it's a way you can fix it. You should include your custom data in the body of the request though. I'm going to leave this open for now just to see if we can/should automatically add the Content-Length header, but otherwise it seems like that's the fix, at least based on what Google is returning to you. |
Beta Was this translation helpful? Give feedback.
-
The reason why my .js code wasn't receiving the params is because of this:
It should be this, and it works. my realtime database gets updated:
|
Beta Was this translation helpful? Give feedback.
-
Hi guys,
Getting close to working functions, but got stuck here.
helloWorld works, I also see both functions in my Firebase server. They also get invoked.
But still I end up with
[Firebase Error] >> { "content": "Fill in Params!" }
I also noticed that leaving the body parameter as an empty dictionary causes an error. So I just added
{"test" : "test"}
to avoid it.[Firebase Error] >> { "content": "<!DOCTYPE html>\n<html lang=en>\n <meta charset=utf-8>\n <meta name=viewport content=\"initial-scale=1, minimum-scale=1, width=device-width\">\n <title>Error 411 (Length Required)!!1</title>\n <style>\n *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n </style>\n <a href=//www.google.com/><span id=logo aria-label=Google></span></a>\n <p><b>411.</b> <ins>That’s an error.</ins>\n <p>POST requests require a <code>Content-length</code> header. <ins>That’s all we know.</ins>\n" }
This is my index.js :
`/**
*/
const {onRequest} = require("firebase-functions/v2/https");
const logger = require("firebase-functions/logger");
const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp();
// Create and deploy your first functions
exports.helloWorld = onRequest((request, response) => {
logger.info("Hello logs v2!", {structuredData: true});
response.send("Hello from Firebase v2!");
});
exports.pawnStunned = functions.https.onRequest(async (request, response) => {
try {
const stunDuration = request.query.stunDuration;
const pathToStunState = request.query.pathToStunState;
const pathToStunnedOn = request.query.pathToStunnedOn;
} catch (error) {
console.error("Error updating pawn state and timestamp:", error);
response.status(500).send("Error updating pawn state and timestamp.");
}
});
`
in Godot:
Beta Was this translation helpful? Give feedback.
All reactions