firebase emulator localhost 500 showing error after updating firebase to latest version - firebase-hosting

after updating to 'Windows 11, version 22H2' and firebase, Local server: http://localhost:5000 is not working showing error 'Cannot GET /' cannot point out what went wrong
happening with all my older peojects also

need to add
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
in firebase.json
under hosting

Related

Flutter website on firebase hosting works fine with domain 1 but not domain 2

I am using flutter web to create a website for my buisness. I am hosting it on firebase hosting with the url
https://xspectre-9a3b3.web.app/
Now when I added the new domain
https://xspectre.net
The website does not load in this domain and gives the error
main.dart.js:1 Uncaught SyntaxError: Unexpected token '<'
(index):1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('https://xspectre.net/') with script ('https://xspectre.net/flutter_service_worker.js'): The script has an unsupported MIME type ('text/html').
It does not work with https://xspectre-9a3b3.firebaseapp.com/ either. What should I do?
EDIT
I discovered the real error is not the MIME type one since it is in my real project too. The actual error is somehow
Uncaught SyntaxError: Unexpected token '<'
When I open the main.dart.js it shows me different code then it should. It shows me the html files not the main.dart.js code and I think that is what is causing the problem. I dont know how or why the files are different for both the URLs.
**EDIT 2 **
Finally figured out the root problem.
Whenever I try to do firebase init, it goes to initialize the whole flutter directory. This means that it says,
You're about to initialize a Firebase project in this directory:
C:\FlutterProjects\xspectre
and not
You're about to initialize a Firebase project in this directory:
C:\FlutterProjects\xspectre\build
Now I need to figure out how to do firebase init and deloy in the /build and not root
The website probably still works for you as it is already cached by the service worker. Try with another browser and it will not work.
firebase init should be run in the project directory, not in the build directory.
After that, edit your firebase.json file to look like
{
"hosting": {
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "**",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
}
]
}
}
"public": "build/web" points to the directory where the files for deployment are.
Now you can do flutter build web and firebase deploy

cordova run android takes "wrong" database

Hello fellow ionic developer,
I use visual studio code (VSC) to develop an ionic 4 application.
Situation:
Usually I emulate an API 19 Android Phone but this has to be builded everytime ionic cordova run android and I can not get it running with the -livereload flag (this takes a lot of time for even little changes). That is when I tried run the app with the cordova plugin for VSC to get a live emulator for debugging and working on my app.
Problemcontext:
I added a database for local storage of patient information. Therefore, I added a seed which provides some patient data and a user. The userlogin works like a charm, during the login I immediatly load all patients for the user. And this is were the problem is:
Apparently, the underlying database / seed is in some old state since I just changed the user values and I can not login with the new seed values.
Unhandled Promise rejection: a statement error callback did not return false: Failed to import SQL; message=sqlite3_prepare_v2 failure: table patient has 14 columns but 27 values were supplied
This is the error that brought me here.
So my question is:
Is there an opportunity to rake/prebuild/... the seed file or where is the seed file located (for using the VSC emulator, since it works on the android studio emulator but also not on the physical device) for the emulator so I can delete or redesign it.
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Android on emulator",
"type": "cordova",
"request": "launch",
"platform": "android",
"target": "emulator",
"port": 8100,
"sourceMaps": true,
"cwd": "${workspaceFolder}",
"ionicLiveReload": true
}
]
}
Thank you in advance
I found a workaround:
//DELETE FOR DEPLOY
this.deleteDatabase("databasename.db");
deleteDatabase(databasename: string)
{
try{
this.sqlite.deleteDatabase(
{
name: databasename,
location: 'default'
}
)
}
catch(error){
console.error(error)
}
}
You should delete the current database and just populate the database again with the new seed.sql
From: https://stackoverflow.com/questions/52033237/how-to-delete-sqlite-database-in-ionic3

Logstash-Forwader 3.1 state file .logstash-forwarder not updating

I am having an issue with Logstash-forwarder 3.1.1 on Centos 6.5 where the state file /.logstash-forwarder is not updating as information is sent to Logstash.
I have found as activity is logged by logstash-forwarder the corresponding offset is not recorded in /.logstash-forwarder 'logrotate' file. The ./logstash-forwarder file is being recreated each time 100 events are recorded but not updated with data. I know the file has been recreated because I changed permissions to test, and permissions are reset each time.
Below are my configurations (With some actual data italicized/scrubbed):
Logstash-forwarder 3.1.1
Centos 6.5
/etc/logstash-forwarder
Note that the "paths" key does contain wildcards
{
"network": {
"servers": [ "*server*:*port*" ],
"timeout": 15,
"ssl ca": "/*path*/logstash-forwarder.crt"
},
"files": [
{
"paths": [
"/a/b/tomcat-*-*/logs/catalina.out"
],
"fields": { "type": "apache", "time_zone": "EST" }
}
]
}
Per logstash instructions for Centos 6.5 I have configured the LOGSTASH_FORWARDER_OPTIONS value so it looks like the following:
LOGSTASH_FORWARDER_OPTIONS="-config /etc/logstash-forwarder -spool-size 100"
Below is the resting state of the /.logstash-forwarder logrotate file:
{"/a/b/tomcat-set-1/logs/catalina.out":{"source":"/a/b/tomcat-set-1/logs/catalina.out","offset":433564,"inode":*number1*,"device":*number2*},"/a/b/tomcat-set-2/logs/catalina.out":{"source":"/a/b/tomcat-set-2/logs/catalina.out","offset":18782151,"inode":*number3*,"device":*number4*}}
There are two sets of logs that this is capturing. The offset has stayed the same for 20 minutes while activities have been occurred and sent over to Logstash.
Can anyone give me any advice on how to fix this problem whether it be a configuration setting I missed or a bug?
Thank you!
After more research I found it was announced that Filebeats is the preferred forwarder of choice now. I even found a post by the owner of Logstash-Forwarder that the program is full of bugs and is not fully supported any more.
I have instead moved to Centos7 using the latest version of the ELK stack, using Filbeats as the forwarder. Things are going much smoother now!

Sensu Handler Gives Undefined Method Error

We've recently updated our OpsGenie handler (opsgenie.rb) to the current community version, found here.
Our handler is defined as:
"opsgenie-pager" : {
"type": "pipe",
"command": "/etc/sensu/handlers/opsgenie.rb -j opsgenie-pager"
}
And our json config for opsgenie-pager is:
{
"opsgenie-pager": {
"customerKey": "<Our API Key>",
"recipients": "<Our Schedule>,<Our Escalation>",
"source": "Admiral Ackbar",
"overwrite_quiet_hours": false,
"tags": [ "admAckbar", "live", "pager" ]
}
}
When a check returns as 'CRITICAL' and the opsgenie handler is called, the sensu-server.log reports:
{"timestamp":"2015-02-03T06:16:17.804061-0700","level":"info","message":"handler output","handler":{"type":"pipe","command":"/etc/sensu/handlers/opsgenie.rb -j opsgenie-pager","name":"opsgenie-pager"},"output":"/etc/sensu/handlers/opsgenie.rb:15:in `<class:Opsgenie>': undefined method `option' for Opsgenie:Class (NoMethodError)\n"}
{"timestamp":"2015-02-03T06:16:17.804210-0700","level":"info","message":"handler output","handler":{"type":"pipe","command":"/etc/sensu/handlers/opsgenie.rb -j opsgenie-pager","name":"opsgenie-pager"},"output":"\tfrom /etc/sensu/handlers/opsgenie.rb:13:in `<main>'\n"}
In our "dev instance" (vagrant box), we're able to successfully use the OpsGenie handler to create alerts.
Any ideas what would be causing the undefined method 'option' for Opsgenie:Class (NoMethodError) error?
Looks like this was the result of an outdated gem.
Out of chance I checked the installed packages (rpms and gems) between our "dev instance" and "production".
The sensu-pluign gem in our dev instance (installed during a vagrant up) was the current version (1.1.0) whereas the version installed on Production was an older version (0.6.3).
Updating this gem with
gem update sensu-plugin
solved this issue!

Sensu Client status

I am trying to see why my Sensu Client does not connect to my Sensu Server.
How can I see the status of the client and whether it tried, succeeded, failed in connecting with the server?
I have installed Sensu Server on CentOS using docker. I can connect to it, the RabbiMQ and Uchiwa panel from my host.
I have installed Sensu Client on Windows host.
I have added following configs:
C:\etc\sensu\conf.d\client.json
{
"client": {
"name": "DanWindows",
"address": " 192.168.59.3",
"subscriptions": [ "all" ]
}
}
C:\etc\sensu\config.json
{
"rabbitmq": {
"host": "192.168.59.103",
"port": 5671,
"vhost": "/sensu",
"user": "sensu",
"password": "password",
"ssl": {
"cert_chain_file": "C:/etc/sensu/ssl/cert.pem",
"private_key_file": "C:/etc/sensu/ssl/key.pem"
}
}
}
I have installed and started the Sensu Client service using following command:
sc create sensu-client binPath= C:\Tools\sensu\bin\sensu-client.exe DisplayName= "Sensu Client"
On the Uchiwa panel I do not see any clients.
The "sensu-client.err.log" and "sensu-client.out.log" are empty, while "sensu-client.wrapper.log" contains this:
2015-01-16 13:41:51 - Starting C:\Tools\sensu\embedded\bin\ruby C:\Tools\sensu\embedded\bin\sensu-client -d C:\etc\sensu\conf.d -l C:\Tools\sensu\sensu-client.log
2015-01-16 13:41:51 - Started 3800
How can I see the status of the Windows client and whether it tried, succeeded, failed in connecting with the server?
Question on the docker, is this one you built yourself? I recently built my own as well only using Ubuntu instead of CentOS.
Recent versions of sensu require the following two files in the /etc/sensu/conf.d directory:
/etc/sensu/conf.d/rabbitmq.json
/etc/sensu/conf.d/client.json
The client.json file will have contents similar to this:
{ "client": {
"name": "my-sensu-client",
"address": "192.168.x.x",
"subscriptions": [ "ALL" ] }
}
The only place I have heard of needing a config.json file is on the sensu-server. But I have only recently been looking at sensu so this may be an older sensu requirement.