Open Joe5K opened 4 years ago
I have the same problem. The function deploys and works correctly though, but it's annoying to have this message all the time.
@Joe5K I think you could remove name: report_reminder
and try again.
The problem with removing 'name' is the HTTP endpoint URL will be different from older serverless-google-cloudfunction version (which uses handler name) while the latest version uses function name as HTTP endpoint URL.
Any news about this issue? I don't know why, but it looks like the serverless-google-cloudfunctions looks for a function name with the name we declared, but replacing its first two characters. So @Joe5K, it will possibly remove the errors if you declare your function reference name like this:
#serverless.yml
...
functions:
port_reminder:
name: report_reminder
handler: report_reminder
events:
- http: path
...
the issue is in the const getFunctionNameInService = (funcName, service, stage) function .... if you overwrite function name like me, it's hardcoded that it has to slice name after removing.... so ugly code on my opinion
for now, be sure the name in properties and the name in the yaml are the same for example :
report_reminder: name: report_reminder
And modify file : info/lib/displayServiceInfos.js change the function getFunctionNameInService with this :
const getFunctionNameInService = (funcName, service, stage) => { let funcNameInService = funcName; if( funcNameInService.indexOf(service)>0 && funcNameInService.indexOf(stage)>0 ){ funcNameInService = funcNameInService.replace(service, ''); funcNameInService = funcNameInService.replace(stage, ''); funcNameInService = funcNameInService.slice(2, funcNameInService.length); } return funcNameInService; };
Should work
This was very helpful @saiaman
Here is what worked for me:
const getFunctionNameInService = (funcName, service, stage) => {
let funcNameInService = funcName;
if( funcNameInService.indexOf(service)>=0 && funcNameInService.indexOf(stage)>=0 ){
funcNameInService = funcNameInService.replace(service, '');
funcNameInService = funcNameInService.replace(stage, '');
funcNameInService = funcNameInService.slice(2, funcNameInService.length);
}
return funcNameInService;
};
I had exactly same issue, changing _
(underscore) to -
(dash) eg
functions:
report_reminder:
to
functions:
report-reminder:
solved problem
Hello,
I want to get rid of service name and stage in function name, but I have a problem setting custom name for function. There is always an error after deployment, it looks like first 2 letters of function are cut off. Did someone resolve this error and could help me solve it? Thanks.