You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deploy the only http function in repo "captureGoogle".
Visit http function, get response with google home screenshot.
Add one comment so that the function will be deployed again, but don't change anything else, and simply deploy the function again.
Visit http function, get Error "Could not find Chrome ", which means the install script from puppeteer not been runned correctly.
Update puppeteer ^21.3.4 to ^21.3.5 and deploy the function again, function works again.
Do not change anything, simply deploy the function again, function stop working again.
[REQUIRED] Expected behavior
The function should work after redeploy.
[REQUIRED] Actual behavior
The function stopped working after redeploy.
Comment
This is a copy of #6412. The solution(#6412 (comment)) provided by @colerogers does not work if multiple functions are deployed as seemly then cache is not created again even tho it does not exists. And then this shows no npm install was run > same Could not find Chrome error happens. Also the second solution(#6412 (comment)) provided is not good
I actually just remembered that we have an experiments command that will clean up artifacts from artifact registry. To delete the cache, you need to delete the function prior to running it. This should work in automation:
I wrote a description there why the provided solution is not good. I will copy the text here to help the reading.
"I think this should be reconsidered to be implemented another way. Deleting a production environment function before deleting the artifacts would resolve to the API endpoint being down in a production environment. This would lead to service not being available for the users. If this would happen every time a function (with puppeteer or similar kind of package) would need to be updated, the service would be unavailable always for a period of time.
Problems:
If such a function is not deployed with an empty cache, the deploy will work, but then the function will not work in usage.
Production and development environments have separate artifact caches, so this can sneak into the production environment even though development would work. This makes this very error-prone.
Reminding the developer always to manually locate to the GCP panel > Artifact registry and find all the functions whose cache needs to be deleted. And to do this always manually on every function deploy is not a good user experience and also does not scale. This approach would bring about other possible problems where, for example, the developer would accidentally delete the function, a folder, or a wrong cache, resulting in the function not working as expected. 4. Deleting the cache does not ensure npm install is run when deploying multiple functions.
My suggestion:
As you mentioned, you can navigate to the Artifact registry and there find your function cache and delete it with no problems, and then deploy the function buildpacks by running npm install. Then the function works as expected. This solution should be made more straightforward and integrated into the standard workflow. To address this, I propose adding a --no-function-cache flag to the firebase deploy command which would delete the cache for the deployed functions. This would solve all previously mentioned issues. "
The text was updated successfully, but these errors were encountered:
Hi @fuelkoy thanks for opening a new issue. So creating a new command or even just adding a flag to an existing command is actually much more complicated than you'd think since every public surface needs to go through an internal review process. I understand that your workflow would greatly benefit from a firebase built solution, so I'm going to mark this as a feature request. Hopefully others can chime in and +1 this so that we can prioritize this work.
But as a stop gap solution for your automation, you should be able to make a call to this API using the path projects/$PROJECT/locations/$FUNCTION_REGION/repositories/gcf-artifacts/packages/$FUNCTION_NAME to delete the artifact registry images/caches. I know this is not a quick solution, but it's better than navigating to the GCP console manually.
[REQUIRED] Environment info
firebase-tools: 13.23.1
Platform: win64
[REQUIRED] Test case
Minimum repo: https://github.com/TrustyTechSG/firebase-function-issue
[REQUIRED] Steps to reproduce
[REQUIRED] Expected behavior
The function should work after redeploy.
[REQUIRED] Actual behavior
The function stopped working after redeploy.
Comment
This is a copy of #6412. The solution(#6412 (comment)) provided by @colerogers does not work if multiple functions are deployed as seemly then cache is not created again even tho it does not exists. And then this shows no
npm install
was run > same Could not find Chrome error happens. Also the second solution(#6412 (comment)) provided is not goodI wrote a description there why the provided solution is not good. I will copy the text here to help the reading.
"I think this should be reconsidered to be implemented another way. Deleting a production environment function before deleting the artifacts would resolve to the API endpoint being down in a production environment. This would lead to service not being available for the users. If this would happen every time a function (with puppeteer or similar kind of package) would need to be updated, the service would be unavailable always for a period of time.
Problems:
4. Deleting the cache does not ensurenpm install
is run when deploying multiple functions.My suggestion:
As you mentioned, you can navigate to the Artifact registry and there find your function cache and delete it with no problems, and then deploy the function buildpacks by running
npm install
. Then the function works as expected. This solution should be made more straightforward and integrated into the standard workflow. To address this, I propose adding a --no-function-cache flag to the firebase deploy command which would delete the cache for the deployed functions. This would solve all previously mentioned issues. "The text was updated successfully, but these errors were encountered: