firebase-tools: : 8.4.2
Platform: : Windows 10
firebase serve --only functions
Result: Cannot understand what targets to deploy. Check that you specified valid targets if you used the --only or --except flag. Otherwise, check your firebase.json to ensure that your project is initialized for the desired features.
Initialize a firebase project using the command firebase init and then select all and select javascript and yes for the options. After the initialization is completed and npm install is done then do firebase serve --only hosting,functions this will fail but firebase serve --only hosting working and on deploying the project with firebase deploy the hosted url for the function returns
Error: Forbidden
Your client does not have permission to get URL /app/timestamp from this server.
function should return the result or else a valid error should be returned.
function serve is not working
Error: Cannot understand what targets to deploy. Check that you specified valid targets if you used the --only or --except flag. Otherwise, check your firebase.json to ensure that your project is initialized for the desired features.
Attachment: firebase.json
@MisterSingh sometimes Windows shells have problems with `--only hosting,functions" because of the comma. Could you try adding quotes so it's like this:
firebase serve --only "hosting,functions"
Also when filing an issue please provide more logs and/or code, this is not really enough information to debug.
No it didn't work even just firebase serve --only functions is also not working but firebase serve --only hosting is working and please can you tell me which all logs can I attach with this ?
@MisterSingh please run the command that isn't working with the --debug flag and supply those logs.
Nvm the command is now working within the quotes and the single function serve --only function was not working because of the typo it should have been functions instead of function MY BAD.
But if I give the command as function or without quotes with the debug flag also there is no proper error message, it still says
Error: Cannot understand what targets to deploy. Check that you specified valid targets if you used the --only or --except flag. Otherwise, check your firebase.json to ensure that your project is initialized for the desired features.

@MisterSingh I'll send a PR to improve this error message.