Functions Framework prevents developers from handling invalid params
See original GitHub issuehttps://github.com/firebase/firebase-tools/issues/3891 seems to have a root cause in the functions framework.
To reproduce without Firebase:
const express = require('express');
const app = express();
app.get('/404', (req, res) => res.send('failed to work'));
app.get('**', (req, res) => res.send('working'));
app.use((err, req, res, next) => res.redirect('/404'));
module.exports.app = app;
if (require.main == module) {
app.listen(8080);
}
If you run the file locally (no functions framework) and curl http://localhost:8080/%CO
the user is redirected to http://localhost:8080/404
.
If you deploy the function and CURL the repo (temporarily) at https://us-central1-inlined-junkdrawer.cloudfunctions.net/param-encoding/%C0
, the functions framework rejects the request before it ever hits customer code with Bad Request
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Troubleshooting Cloud Functions - Google Cloud
Failure to do so may cause your function to stop executing at the wrong time. The error behavior. Your function exhibits one of...
Read more >Google cloud function not handling sigint - Stack Overflow
Yeah, this is dumb. I don't have a solution, but my workaround is: Ctrl+C; Hit the URL from the browser. For some reason...
Read more >Manage functions | Cloud Functions for Firebase - Google
... the Firebase CLI supports multiple arguments as well as functions groups, ... for a function that's handling production traffic, you can prevent...
Read more >The 10 Most Common JavaScript Issues Developers Face
Powerful JavaScript-based libraries and frameworks for single page ... JavaScript Issue #6: Incorrect Use of Function Definitions Inside for Loops.
Read more >Error Handling - Laravel - The PHP Framework For Web Artisans
All exceptions are handled by the App\Exceptions\Handler class. This class contains a register method where you may register custom exception reporting and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for your response @grant.
The middleware solution you offered is not supported and cannot be a workaround as the URL is checked before it gets to any cloud function. @inlined code shows the middleware sample.
Thanks.
What would you like the dev experience to be ideally? Expected behavior? Can you write that out?
I’m hearing you’d like to still invoke the function, but the server cannot accept a bad request. An error handler? Express sets up the router and processes params a bit out of our control.