Android app connection with firebase real time database failure error - javascript

Tried to connect firebase realtime database with my android app and updated firebase gradle files, since then this error causes my app to crash, HELP:
2021-06-19 12:47:52.128 23038-23038/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.drowsinessdetection, PID: 23038
java.lang.NoSuchMethodError: No static method metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; in class Ljava/lang/invoke/LambdaMetafactory; or its super classes (declaration of 'java.lang.invoke.LambdaMetafactory' appears in /apex/com.android.runtime/javalib/core-oj.jar)
at com.google.firebase.components.ComponentDiscovery.discoverLazy(ComponentDiscovery.java:112)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:418)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2154)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2128)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:7294)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6765)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6615)
at android.app.ActivityThread.access$1600(ActivityThread.java:232)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1953)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7697)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950
build.gradle(app) config & firebase versions

Related

Expo npm run ios fails after adding slug

I have an app made with react-native expo, and i wanted to try and build it so i can set up firebase.
According to expo instructions, i created a project on expo.dev with the same name and added "owner" and "slug" to my app.json file. However, when trying to run "npm run ios" after adding the slug i get this error, which i have no idea what means.
ossible Unhandled Promise Rejection (id: 0):
Error: Directory for 'file:///Users/julz/Library/Developer/CoreSimulator/Devices/22E46E5F-3F35-495D-8E02-C3DDED361E02/data/Containers/Data/Application/7924CAA0-6983-4208-BBD1-EB9F6A2746C9/Library/Caches/ExponentExperienceData/%2540jujasen%252Ftrachi/ExponentAsset-b3263095df30cb7db78c613e73f9499a.ttf' doesn't exist. Please make sure directory '/Users/julz/Library/Developer/CoreSimulator/Devices/22E46E5F-3F35-495D-8E02-C3DDED361E02/data/Containers/Data/Application/7924CAA0-6983-4208-BBD1-EB9F6A2746C9/Library/Caches/ExponentExperienceData/%40jujasen%2Ftrachi' exists before calling downloadAsync.
promiseMethodWrapper#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:20580:45
#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:98019:46
#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:101458:61
generatorResume#[native code]
asyncGeneratorStep#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:21901:26
_next#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:21920:29
#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:21925:14
tryCallTwo#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:26684:9
doResolve#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:26816:25
Promise#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:26703:14
#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:21917:25
_downloadAsync#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:101462:32
downloadAsync#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:101450:32
#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:100951:67
generatorResume#[native code]
asyncGeneratorStep#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:21901:26
_next#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:21920:29
tryCallOne#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:26676:16
#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:26757:27
#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:27715:26
_callTimer#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:27630:17
_callReactNativeMicrotasksPass#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:27663:17
callReactNativeMicrotasks#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:27827:44
__callReactNativeMicrotasks#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:20999:46
#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:20799:45
__guard#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:20979:15
flushedQueue#http://192.168.0.107:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:20798:21
flushedQueue#[native code]
invokeCallbackAndReturnFlushedQueue#[native code]
The slug for my app used to be "Trachi", but since the slug in expo.dev is "trachi" with lowercase i had to change it to that. If i put the old slug with the uppercase T back, the app works without errors again. Does anyone have any idea how i can solve this?

Firebase Cloud messaging - permissions error for cloud build deployed app

I have a java spring boot backend app, that I am trying to hook up to Firebase Cloud Messages.
I have an android app that uses firebase and I am trying to use this backend to push notifications.
I've generated a private key from firebase console project settings, placed the json file - and the following worked LOCALLY perfectly:
try {
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(new ClassPathResource("PATH_TO_GENERATED_JSON").
getInputStream())).build();
if (FirebaseApp.getApps().isEmpty()) {
FirebaseApp.initializeApp(options);
logger.info("Firebase application has been initialized");
}
} catch (IOException e) {
logger.error(e.getMessage());
}
...
response = FirebaseMessaging.getInstance().send(message);
I have set up google cloud build to automatically trigger and build from github.
But I cannot commit the json credentials file (right?), so for cloud deployment I have changed the initialization part to:
if (FirebaseApp.getApps().isEmpty()) {
FirebaseApp.initializeApp();
logger.info("Firebase application has been initialized");
}
But I have received errors information about project id not set, so I have also edited the cloud build trigger inline YAML with:
--update-env-vars=GOOGLE_CLOUD_PROJECT=XXXXXXXXXXX
But now I am getting the following error when trying to send the message:
com.google.firebase.messaging.FirebaseMessagingException: Permission 'cloudmessaging.messages.create' denied on resource '//cloudresourcemanager.googleapis.com/projects/XXXXXXXXXXX' (or it may not exist).
(XXXXXXXXXXX being my project id)
I've started giving "Firebase Cloud Messaging Admin" role left and right on https://console.cloud.google.com/iam-admin/iam?project= but that didn't help :(
Can anyone help?
Adding stack trace:
com.google.firebase.messaging.FirebaseMessagingException: Permission 'cloudmessaging.messages.create' denied on resource '//cloudresourcemanager.googleapis.com/projects/our-shield-329019' (or it may not exist).
at com.google.firebase.messaging.FirebaseMessagingException.withMessagingErrorCode(FirebaseMessagingException.java:51)
at com.google.firebase.messaging.FirebaseMessagingClientImpl$MessagingErrorHandler.createException(FirebaseMessagingClientImpl.java:293)
at com.google.firebase.messaging.FirebaseMessagingClientImpl$MessagingErrorHandler.createException(FirebaseMessagingClientImpl.java:282)
at com.google.firebase.internal.AbstractHttpErrorHandler.handleHttpResponseException(AbstractHttpErrorHandler.java:57)
at com.google.firebase.internal.ErrorHandlingHttpClient.send(ErrorHandlingHttpClient.java:108)
at com.google.firebase.internal.ErrorHandlingHttpClient.sendAndParse(ErrorHandlingHttpClient.java:72)
at com.google.firebase.messaging.FirebaseMessagingClientImpl.sendSingleRequest(FirebaseMessagingClientImpl.java:127)
at com.google.firebase.messaging.FirebaseMessagingClientImpl.send(FirebaseMessagingClientImpl.java:113)
at com.google.firebase.messaging.FirebaseMessaging$1.execute(FirebaseMessaging.java:137)
at com.google.firebase.messaging.FirebaseMessaging$1.execute(FirebaseMessaging.java:134)
at com.google.firebase.internal.CallableOperation.call(CallableOperation.java:36)
at com.google.firebase.messaging.FirebaseMessaging.send(FirebaseMessaging.java:104)
at com.google.firebase.messaging.FirebaseMessaging.send(FirebaseMessaging.java:86)
at com.miloszdobrowolski.investobotbackend.InvestobotAPIs.testNotification(InvestobotAPIs.java:120)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1726)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: com.google.api.client.http.HttpResponseException: 403 Forbidden
As listed in the Understanding Roles documentation, Firebase Cloud Messaging Admin does not have a cloudmessaging.messages.create permission. In order to add this permission, use one of the following roles:
Firebase Admin (roles/firebase.admin)
Firebase Grow Admin (roles/firebase.growthAdmin)
Firebase Admin SDK Administrator Service Agent (roles/firebase.sdkAdminServiceAgent)
Firebase SDK Provisioning Service Agent (roles/firebase.sdkProvisioningServiceAgent)

React Native - Emulator - Hermes library crash - couldn't find DSO to load: libhermes.so

After successfully installing the app, when trying to lauch it on the emulator, the following crash occurs. Details below:
2020-07-13 14:50:17.365 3375-3722/com.Myapp E/AndroidRuntime: FATAL EXCEPTION: create_react_context
Process: com.Myapp, PID: 3375
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:789)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525)
at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:997)
at java.lang.Thread.run(Thread.java:923)
Add to android/app/build.gradle
configurations.all {
resolutionStrategy {
force "com.facebook.soloader:soloader:0.8.0"
}
}
and make sure that enableHermes: false

GCP: ymal environment variable format for app engine

I'm trying to deploy my web app to App Engine in GCP. I have my API key and Client key stored in my app.yaml file. but when I try to deploy my app I'm getting this error:
ERROR: (gcloud.app.deploy) An error occurred while parsing file:
[C:\app.yaml]
Value 'API-KEY' for key in EnvironmentVariables does not match expression '^(?:
[a-zA-Z_][a-zA-Z0-9_]*)$'
in "C:\app.yaml", line 4, column 12
and here is my app.yaml file:
runtime: nodejs
env: flex
env_variables:
API-KEY: 'ExampleAPIKey'
CLIENT_ID: 'example123-clientkey1234567890.apps.googleusercontent.com'
I tried to remove the '' but I got the same error message. I don't know what I'm missing here.

Connecting NodeJS app to SignalR (with .NET Core 3)

I have a server running SignalR using .NET Core 3. The project was started with the template and I followed a guide (https://learn.microsoft.com/en-gb/aspnet/core/tutorials/signalr?tabs=visual-studio&view=aspnetcore-3.0).
I have created a clone of the project, and can successfully connect to the server and can receive messages as expected. This also means I added CORS.
I want to be able to use SignalR in a Node JS environment, but the connection stucks at "Negotiation"
I have created a brand new folder, ran npm init -y and npm i #microsoft/signalr.
Created a new js file called main.js, which looks like this:
const signalR = require("#microsoft/signalr");
let connection = new signalR.HubConnectionBuilder()
.withUrl("http://localhost:44336/chathub")
.configureLogging(signalR.LogLevel.Trace)
.build();
connection.on("send", data => {
console.log(data);
});
connection.start()
.then(() => connection.invoke("send", "Hello"));
after running it with node main.js
I get the following error in console
[2019-11-26T14:56:14.933Z] Debug: Starting HubConnection.
[2019-11-26T14:56:14.935Z] Debug: Starting connection with transfer format 'Text'.
[2019-11-26T14:56:14.936Z] Debug: Sending negotiation request: http://localhost:44336/chathub/negotiate.
[2019-11-26T14:58:18.890Z] Warning: Error from HTTP request. Error: read ECONNRESET
[2019-11-26T14:58:18.891Z] Error: Failed to complete negotiation with the server: Error: read ECONNRESET
[2019-11-26T14:58:18.892Z] Error: Failed to start the connection: Error: read ECONNRESET
[2019-11-26T14:58:18.892Z] Debug: HubConnection failed to start successfully because of error 'Error: read ECONNRESET'.
It seems like it's timing out. The server, client and nodejs app are all hosted locally.
I made sure to check that the signalr version installed with npm i match the version of server (3.0.1). I even extracted the js files in node_modules and used them for another client (made with the VS template) and it can connect just fine.
I have no clue how to debug any further. I tried to attach to the server using VS, but I couldnt get any information. The server is hosted using IIS Express (started via Visual Studio).
Any tips on how to debug any further? otherwise I might downgrade to a previous .NET Core version with another signalr version
My startup.cs code in VS
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
//services.AddControllersWithViews();
services.AddCors(options =>
{
options.AddPolicy("AllowAll",
builder =>
{
builder
.WithOrigins("http://localhost:44399", "http://localhost:44336", "https://localhost:44399", "https://localhost:44336")
.AllowCredentials()
.AllowAnyMethod()
.AllowAnyHeader();
});
});
services.AddSignalR();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseCors("AllowAll");
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<ChatHub>("/chathub");
});
}
}
Don't know if this is the root cause or not, but I stumbled on this in my setup.
The default settings for IISExpress in Visual Studio do not listen on the same port for http and https. I was using the SSL port in my node.js file, but using the http protocol. I suspect your problem might be the same, since VS usually defaults to the 44000 range for SSL ports.
What confused me was the fact that my browser would pop up on the SSL port during debugging.
In my case, I checked ./Properties/launchSettings.json to get the ports being used:
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:63591",
"sslPort": 44357
}
},
Then updated my js file accordingly:
const signalR = require("#microsoft/signalr");
var hubConnection = new signalR.HubConnectionBuilder()
.configureLogging(signalR.LogLevel.Trace)
.withUrl("http://localhost:63591/chatHub")
.build();
And voila. Run the app in Visual Studio 2019, and then on the command line:
davek-win64% node app.js
[2020-08-05T21:20:15.483Z] Debug: Starting HubConnection.
[2020-08-05T21:20:15.490Z] Debug: Starting connection with transfer format 'Text'.
[2020-08-05T21:20:15.491Z] Debug: Sending negotiation request: http://localhost:63591/chatHub/negotiat
e.
[2020-08-05T21:20:15.591Z] Debug: Selecting transport 'WebSockets'.
[2020-08-05T21:20:15.592Z] Trace: (WebSockets transport) Connecting.
[2020-08-05T21:20:15.615Z] Information: WebSocket connected to ws://localhost:63591/chatHub?id=sYmFd19
_rNCR7q3mddpJBA.
[2020-08-05T21:20:15.616Z] Debug: The HttpConnection connected successfully.
[2020-08-05T21:20:15.616Z] Debug: Sending handshake request.
[2020-08-05T21:20:15.619Z] Trace: (WebSockets transport) sending data. String data of length 32.
[2020-08-05T21:20:15.621Z] Information: Using HubProtocol 'json'.
[2020-08-05T21:20:15.633Z] Trace: (WebSockets transport) data received. String data of length 3.
[2020-08-05T21:20:15.634Z] Debug: Server handshake complete.
[2020-08-05T21:20:15.635Z] Debug: HubConnection connected successfully.
Connected!
[2020-08-05T21:20:28.547Z] Trace: (WebSockets transport) data received. String data of length 74.
stackoverflow test
[2020-08-05T21:20:30.637Z] Trace: (WebSockets transport) sending data. String data of length 11.
[2020-08-05T21:20:31.197Z] Trace: (WebSockets transport) data received. String data of length 11.
You should consider your middleware order
public void ConfigureServices(IServiceCollection services)
{
services.AddCors(options =>
{
options.AddPolicy("AllowAll",
builder =>
{
builder
.WithOrigins("http://localhost:44399",
"http://localhost:44336",
"https://localhost:44399",
"https://localhost:44336")
.AllowCredentials()
.AllowAnyMethod()
.AllowAnyHeader();
});
});
services.AddSignalR();
services.AddControllersWithViews();
}
Try this to see if it work for you. You can refer to my other answer here

Categories