0

When I deploy my Azure Static Web App to Azure with an Azure Function which makes use of PuppeteerSharp, I see the following error in Application Insights:

Exception while executing function: ProductsGet Access to the path 'C:\Program Files (x86)\SiteExtensions\Functions\3.3.1\32bit\.local-chromium' is denied.

If I look locally, there is a 'bin\Debug\netcoreapp3.1' folder with a '.local-chromium' folder within it.

I tried to change the path where the '.local-chromium' folder is, with

var tempPath = Path.Combine(rootPath, "bin/.local-chromium");
var browserFetcher = new BrowserFetcher(new BrowserFetcherOptions
                {
                    Path = tempPath
                });
                await browserFetcher.DownloadAsync();
                await using var browser = await Puppeteer.LaunchAsync(
                    new LaunchOptions
                    {
                        Headless = true,
                        ExecutablePath = browserFetcher.RevisionInfo(BrowserFetcher.DefaultChromiumRevision).ExecutablePath
                    }
                );

But that doesn't work. With normal Azure Functions, I can have a look with Kudu to see the folder structure. Is that also possible with Azure Static Web Apps?

Andy Man
  • 1
  • 3
  • Did you read this post https://anthonychu.ca/post/azure-functions-puppeteer-pdf-razor-template/? – hardkoded Nov 15 '21 at 12:04
  • @hardkoded thanks for the link. I haven't read the post. I will give it a try and come back with the result. – Andy Man Nov 15 '21 at 18:45
  • @hardkoded it didn't work. Althought the azure-pipeline.yml ```trigger: - main pool: vmImage: ubuntu-latest steps: - checkout: self submodules: true - task: AzureStaticWebApp@0 inputs: app_location: '/angular-app' api_location: 'Api' output_location: '/dist/angular-app' azure_static_web_apps_api_token: $(deployment_token)``` tells it to use ubuntu-latest as the vm-image, the Azure Function is deployed on a Windows OS. I logged `RuntimeInformation.IsOSPlatform(OSPlatform.Windows)` to ApplicationInsights. – Andy Man Nov 19 '21 at 15:49
  • Hi @AndyMan, did You resolve the problem? – Mateusz Kaleta Aug 03 '22 at 18:24

0 Answers0