-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling different baseUrl when using firebase functions #120
Comments
Think I have the same problem. @manwithsteelnerves Did you find a solution? |
@larssn Are you using cloud functions? If so, you can try this hack.
We call validator.validate from our routes as a middleware call. |
Thanks for the quick response! We are indeed using cloud functions. However our |
Figured it out, we had to do: validate : () => (req: any, res: any, next: Function) => {
req.baseUrl = '/v1';
console.time("Validate Request");
internalValidate(req, res, next);
console.timeEnd("Validate Request");
} Thanks for the hint. Saved us some time! |
I forgot to add how we have the baseUrlPrefix
We saved it in at very first router to avoid hardcoding :) |
@larssn @manwithsteelnerves glad to see you've managed. Adding a baseUrlPrefix sounds like a legitimate feature and we'll consider adding that. |
Great! |
When using firebase functions, the baseUrl is pre-fixed with the region+function name and this is dynamically added at the time of launching the cloud function.
Is there any way to handle without modifying the input spec baseUrl?
const path = req.baseUrl.concat(req.route.path);
The above code is not matching the path that was added in the spec. As we maintain different environments during development, its not possible to provide multiple schema json in init just to avoid this problem
Any solutions would be great!
The text was updated successfully, but these errors were encountered: