WebGL build. RangeError: too many arguments provided for a function call createUnityInstance

Not sure what I’ve done wrong or if I need to add more.

When I Build And Run inside Unity it creates the window and loads without issue.

Have a path setup inside the wwwroot of the our .netcore webapp to put the WebGL build in. Initially I was getting the following.

Unable to parse /MyApp/Build/Builds.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header “Content-Encoding: gzip” present. Check browser Console and Devtools Network tab to debug.

I then added the following code which resolved the parsing error.

   public static IApplicationBuilder UseStaticFilesExtendedTypes(this IApplicationBuilder app)
   {
       var provider = new FileExtensionContentTypeProvider();
       provider.Mappings[".glb"] = "model/gltf-binary";
       provider.Mappings[".env"] = "application/octet-stream";

       // app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider });

       app.UseStaticFiles(new StaticFileOptions
       {
           ContentTypeProvider = provider,
           OnPrepareResponse = content =>
           {
               if (content.File.Name.EndsWith(".js.gz"))
               {
                   content.Context.Response.Headers["Content-Type"] = "text/javascript";
                   content.Context.Response.Headers["Content-Encoding"] = "gzip";
               }
               if (content.File.Name.EndsWith(".wasm.gz"))
               {
                   content.Context.Response.Headers["Content-Type"] = "application/wasm";
                   content.Context.Response.Headers["Content-Encoding"] = "gzip";
               }
           }
       });

       return app;
   }

Now when I run the web application. The Unity WebGL page loads and progress bar gets to about 90% and produces the following.

createUnityInstance/l/</<@https://localhost:5001/MyApp/Build/Builds.loader.js:1:5770
promise callback*createUnityInstance/l/<@https://localhost:5001/MyApp/Build/Builds.loader.js:1:5417
callRuntimeCallbacks@https://localhost:5001/MyApp/Build/Builds.framework.js.gz:3:19279
preRun@https://localhost:5001/MyApp/Build/Builds.framework.js.gz:3:14671
run@https://localhost:5001/MyApp/Build/Builds.framework.js.gz:3:359513
runCaller@https://localhost:5001/MyApp/Build/Builds.framework.js.gz:3:358850
removeRunDependency@https://localhost:5001/MyApp/Build/Builds.framework.js.gz:3:15974
receiveInstance@https://localhost:5001/MyApp/Build/Builds.framework.js.gz:3:17723
receiveInstantiationResult@https://localhost:5001/MyApp/Build/Builds.framework.js.gz:3:17840
promise callback*unityFramework/createWasm/instantiateAsync/<@https://localhost:5001/MyApp/Build/Builds.framework.js.gz:3:18451
promise callback*instantiateAsync@https://localhost:5001/MyApp/Build/Builds.framework.js.gz:3:18354
createWasm@https://localhost:5001/MyApp/Build/Builds.framework.js.gz:3:18914
unityFramework@https://localhost:5001/MyApp/Build/Builds.framework.js.gz:3:293288
createUnityInstance/l/<@https://localhost:5001/MyApp/Build/Builds.loader.js:1:5335
promise callback*l@https://localhost:5001/MyApp/Build/Builds.loader.js:1:5317
createUnityInstance/<@https://localhost:5001/MyApp/Build/Builds.loader.js:1:18860
createUnityInstance@https://localhost:5001/MyApp/Build/Builds.loader.js:1:18452
script.onload@https://localhost:5001/lib/unity-loader.js:64:24
EventHandlerNonNull*@https://localhost:5001/lib/unity-loader.js:63:1```

Is there a way to see what is getting passed through the createUnityInstance? Or do I need to configure it more?

Build settings:

[![](https://i.stack.imgur.com/y0zjw.png)](https://i.stack.imgur.com/y0zjw.png)

I am hitting the same error as I try to host the game in an AWS bucket.
I am using application/wasm as the type for the wasm.gz
I am using encoding gzip for the gz files in the bucket.

I managed to fix it by adding changing the content-type of the wasm file to application/wasm and removing the content-type of the other .gz files under Build