Although allowing guest users, couchbase requires authentication - couchbase

I created a couchbase bucket to sync it with ionic 2 app using PouchDB
In the sync-gateway file I allowed guest users :
"users": {
"GUEST": {
"disabled": false,
"admin_channels": ["*"]
}
}
I was able to access the database normally, adding docs from the app successfully, syncing was working perfectly with all devices.
But after few hours of developing (without any changing in the sync config file!):
It started to require username and password
The docs at the bucket were deleted completely!:
This problem happened twice with the same scenario.
I searched for the reason, but without avail, any help will be appreciated
THANK YOU

Related

cloud function rewrite 302

We have a website that uses firebase rewrites with cloud functions. Depending on my computers or accounts running firebase deploy --only functions,hosting results in an error sometimes. The error is 302 with redirect request prompting a login screen: https://us-central1-foo.cloudfunctions.net/_ah/conflogin?continue=https://us-central1-foo.cloudfunctions.net/get-calendars/api/calendars
"rewrites": [{
"source": "/api/calendar",
"function": "get-calendar"
}
]
I am still not sure what exactly is a root issue but I suspect firebase deploy is causing the problem. I have tried deploying the sames files with different settings:
I have accounts A, B and three machines (linux 1, linux 2, mac)
Deploying on linux 1 with account A has the problem
Deploying on mac with account A works fine
Deploying on linux 2 with account B works fine
I created the files for deployment on linux 1. What confuses me is account A works ok on mac but not on linux because I was suspecting an auth or permission issue. Does anyone know what causes my problem?

Angular SPA for Offline Use (with DDBB)

I am developing an invoice app with Angular + NodeJs + MySql.
The thing is, the app is planned to be used by one employee in his office. No need for online servers.
It is not problematic to deploy the app online, but the internet is unstable in the zone (Latinamerican problem. You may lose connection for hours, and even voltage variations that may shut down the PC).
So the app must be self sufficient to always work offline.
So my questions are:
Can I simply deploy the app offline? Like in local. If that is the case, I would need for everything to be initialized automatically when the user opens the app (server open, database connected...).
If I have no way but to deploy the app online, should I use Firebase? Also, what happen if the internet service shut downs for hours? Is there a way for the database to be available offline and sync when the internet gets back?
You could build the app as an Electron App, then its becomes a locally run program. https://www.electronjs.org/
You can host it anywhere, but turn the app in to a PWA, which means it will work locally in the browser after a successful visit (gets installed with a service worker in browser) For the database it self, you can store data in the browser but some are limited to 5mb of data in the localstorage / sessionStorage / indexdb. Firebase does have some locally cached data. But if the browser is closed it can be lost.
If it needs to run locally i would go the electron route. Its slightly harder to do but it fills out your usecase better.
You can use both ways if you want to be sync like situation you have to hold data if your internet is not working in local storage or indexed db.
and it is fine you can deploy locally also or make one dedicated server which is always on.so any body in same network can use that angular app easily.
Just take care of backup plan when you system corrupt you should have proper backup of database for such scenario.

Issue connecting migrated .net site to MySQL db on Synology NAS using Web Service and myPHPAdmin

I migrated an existing .NET site and db but was asked to move it to a Synology NAS box. The site is up and running and I've added users to the to the db using myPHPAdmin but I'm unable (or don't know how) to connect the db to the site in this environment. There is a un and pw box on the site but the button is unpressable after the migration. Below is the old appsettings json for the site. The image repository line has been changed but the imager connection string is old and I'm not sure what this now needs to be or if this is the correct route to fix the issue. I'm a little out of my element on this synology box, any and all suggestion/direction is greatly appreciated. Ty
{
"ConnectionStrings": {
"imager": "Server=DATABASE_URL;Database=DATABASE_NAME;User Id=USERNAME;Password=PASSWORD;"
},
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",
"ImageRepository": "/web/visionboard/wwwroot/images/repo"
}

Database issues with deploying ASP.NET MVC web app in Azure

I have a web app published to Azure built in Visual Studio MVC. Many times after publishing updated files the app will fail when querying the database so it seems. For instance the home page will load fine but the app will crash when a link is selected that connects to my database. It is a MySQL database hosted remotely.
Here's the error for the deployed version:
I'm not sure how to interpret the error either and I've looked into enabling development mode in my app but as far as I can tell it is enabled.
Occasionally after a few restarts through Azure the app will start working fine and the app consistently works when I build and launch through Visual Studio. It leads me to believe this is an Azure issue conflicting with my data base setup.
It's making testing a real hassle and I don't have confidence the app/database will be up when I need it to.
Thank you for your help!
I think that you need to get the detailed error message to interpret the error.
To get the error message in azure, we can watch the diagnostic logs, about how to do this, we can refer to: Enable diagnostics logging for web apps in Azure App Service
We can also display the error message directly on browser. For example, if you are using ASP.NET core MVC, we can do as below:
Replace the below code of Startup class:
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
With:
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
When the error occurs again, we can see the error message at browser directly

authenticate user on offline mode

We have a app which works offline as the data is stored locally using local storage and HTML5 offline capabilities.
We want a way to authenticate the user when the user tries to launch the app offline (from a security purpose if ipad gets stolen).
We already have the authentication mechanism when the user tries to access the app while online
Crudely, you can use the person's password as the local storage database name. No password, no database access.
One solution is to save the last successful online login into some local storage. Now when user is in offline-mode then compare with the value stored in Local Storage.
Following is the sample snippet for Local Storage in HTML 5 :
if (window.localStorage.getItem('value')) {
dummy = window.localStorage.getItem('value');
}
Hope this might solve the problem.