Aviarc workflows not executing - aviarc

I have an Aviarc application with a MySQL database.
The main functions of the system are accessed via a main screen with buttons which call different workflows. I added a login form which checks credentials against an authority. This was working. After several unrelated small changes, I have encountered the following problems:
none of the buttons in the application work (the browser tells me
they all link to javascript:void(0)
when I go to a workflow directly (type in url), the called form opens, but without data in it
I have tried the following:
removed the authentication
start up a new instance of the application
tested database connectivity (test query works)
It looks as if none of the workflows execute properly. I'm only at beginner level, so any advice would be welcome.

Related

how to add user authentification to node red from a webpage that run on the same server

I have problem with node-red.
I have a server and i have node-red running on it, i know how to create user authentification by editing setting.js file but what i want to do is that i want to be able to create other users from a webpage that is running on the same server.
I can run a python script that edit the setting.js file and i can edit it mannualy,
but i want to be able to create and remove users from the webpage that is running on the same server.
i am using ubuntu and ngninx on my server.
The Node-RED security documentation includes a section on adding custom user authentication here. It explains how you can replace the hard coded user information with a module that will authenticate a given user. Editing the settings.js is probably not the right approach, especially as it will require you to restart Node-RED after each change.
With this approach you can build your own back end to store and manage users. There are a couple of examples of such code available, including this one that I have written that uses MongoDB to hold the user information. The management app that creates users can be found here, but you can write your own in Python if you want.
Just as a reminder, Node-RED is not a true multi-user environment, even if you declare a number of users, they will all only have shared access to one instance and set of flows. If you want a truly multi-tenant (each user has their own instance and flows) deployment you should probably look at the entire series of posts in that collection that explains how to build such a system. You can start here.

Previewing failed, but deployment works

Background:
I'm quite new to App Maker, but have been involved in programming/IT for over 2 decades.
I have created an App Maker app, which works fine. It is deployed, and functions internally in our organization.
It accesses a Team Drive spreadsheet, makes modifications to it based on input criteria, and sends an email out to a hardcoded user. It uses no external GCP database or other resource.
The OAuth scopes it requires are:
admin.directory.user.readonly
drive.readonly
script.send_mail
spreadsheets
userinfo.email
Problem:
I can no longer preview the app.
When I click on "Preview" at the top right, a new tab opens and a spinning wheels seems to indicate that the preview is loading. Within about 4 seconds, the tab closes and the original tab (with the scripts, UI etc) gives a "Previewing failed. Dismiss" error in the bottom centre.
I am both able to deploy the exact same code/UI/etc, as well as run it without issue.
I do not know what I changed, since being able to preview the app, but cannot seem to regress to that state.
What I've tried:
Admittedly not much, as I don't know where to look. I'm rather certain that there must be some setting somewhere, but for all my googling, I've come up empty.
This can't be a client/server script or other syntax issue, as otherwise the deployment also wouldn't work.
With a more meaningful error, I would know where to look.
Expected Result:
Obviously, I should be able to preview the app if it is deployable.
Following #Morfinismo's comment, I contacted G Suite Support; my matter was escalated to the API Team.
I was asked by Google Cloud Support ("Support") to provide network traffic info using FiddlerCap. As I am on a linux machine and FiddlerCap is a windows application, I suggested alternatives (eg:Wireshark). It was eventually not required and never provided.
I noticed that on the Google scripts page, when accessing the project in question selecting "Preview", it was missing the following OAuth:
https://www.googleapis.com/auth/admin.directory.user.readonly
The functioning deployed version did not have this missing.
Still in the Preview, I selected "Stackdriver (logs)", which gave me an error that the project had been deleted. The actual wording was:
Access forbidden
Project XXXX is shut down and scheduled to be deleted. A project owner can cancel the shutdown on the projects list page.
Clicking on the link in the error "Go to projects list page" brought me to a page with the title "Resources pending deletion", which did not load a list of projects (but otherwise fully loaded) and would display the spinning wheel in perpetuity. I attempted this multiple times, including leaving it overnight once.
Support presumed that I had deleted the GCP project, although I honestly don't/didn't think I had. I also confirmed that creating new previews did not work, but creating new deployments did. I also confirm(ed) that this particular App Maker app did not require (eg) a GCP SQL database.
Support pointed me toward the following website: Google undelete project and I was asked to follow these steps (copy-pasted here):
a. For projectId, enter your project ID. From the screenshot you provided, this is "XXX (redacted)" (the quotes are just to emphasise the project ID, you shouldn't enter them.
b. Click EXECUTE.
c. You'll be prompted to grant authorisation, which may be preceded by a prompt to choose your admin account. Please do so.
d. You should receive a 200 response, with an empty body, that is {}.
e. Attempt to access the project via Project link (with the actual project id redacted here).
The above yielded some strange behaviour:
a. undeleteing the project gave it a different name that the App Maker app;
b. I notice that I had 3 other projects all called correctly (the App Maker app name).
c. When asked to reauthorize, I was provided with yet another project name ("Untitled project"), which was different from the correct one and different from the one in para. 7a, above.
d. I then also obtained another error in a new window which read:
That's an error
Request Details
(a bunch of stuff)
That's all we know.
Support advised that there may be a propagation issue, and that I should wait up to 30 minutes. I did, and it then worked! The only weird thing was the project name was wrong, but it was only for the preview, so I didn't really care.
If anyone needs additional information, I can PM screenshots I took along the way.
Hope this helps someone!
SJL

Initializing an asp.net deployment

I have a basic webforms asp.net site. Currently its working on pre-created sql tables and I have to manually triger it to update data. Moving towards a live deployment though, I'd like to make it more comfortable.
How would I make it so that whenever the server software loads it up, the first thing it does before accepting any requests is to run an initialization sub? Just so I can make sure all the tables are there and if not I would create them etc.
Also, I'd like to run another sub that would trigger the data update periodically every few hours. I was thinking that if I could get my initialization sub, I could just spawn a background thread to deal with that but if theres a built-in option, I'll take it.
whenever the server software loads it up
In asp.net, you have the global.asax file - open the code behind for that and look at the possible overrides. Among them will be:
protected void Application_Start()
This always runs when the application starts up and you could use this to check the DB.
If you're in an "in-house" environment where there's a single live database server and a single live application server, then it should be ok to assume that the database is deployed before the application and you won't need this. If you're providing an application to a third-party or providing it on the web, then this is a good place to check. How you generate the DB is up to you, but checking here is a good idea. You could also have a (hidden) admin page on your site that checks the database connection etc.
trigger the data update periodically
This won't be built-in to asp.net as asp.net waits for requests and responds to them. There are ways around this, but generally triggered externally to the application. The easiest is a simple windows scheduled task that hits a page to trigger the check.
This is what's referred to as "deployment".
If your web site is deployed via MSI, this step should be done in MSI.
If your web site is deployed via Visual Studio "publish" option, this is where you need to create tables.
Some applications indeed do as you say, e.g.: create SQL tables on the 1st run. The problem with this approach is that your app will need sa rights, instead or simple read/write. This could lead to security issues.
Code which runs on web site launch (which is where initialization belongs to) is located in global.asax in:
protected void Application_Start()

How can I code my web app so that it knows what web server it's on?

My company has an ASP.NET web app that runs on a web farm that's load balanced by Enterprise Foundry ServerIron XL 8 hardware. For debugging purposes, we've got a page that just reports what server it's running on. Currently, we manually copy a different version of this page to each server, and hardcode the name of that server (e.g. www1, www2, or www3). What I'd like instead is to find a way for the app to determine this information itself, so we don't have to do this manual step, outside of the code itself, but I can't find any way to accomplish this.
So the question is: how can an ASP.NET app be made aware of where it's actually running?
You can do this via IIS itself.
Find the web application. In the app's main config page (features view), under IIS section you'd find HTTP Response Headers. This feature enables you to add/remove headers which need to be sent along with every response of that application.
However, you'd need tools like fiddler to be able to inspect such data.
Another option is a custom server control or user control, placed anywhere within a page which will output that information during it Render phase (as html comment). You can get using System.Environment class.
var mc_name = System.Environment.MachineName;

Updating an existing web app advice for asp.net

I have a web application that is used by several different clients. At the moment the process of updating their end with any changes is like so:
Publish/Compile App
Put relevant files into a zip (not web.config as different db paths for each client and don't want to overwrite)
Generate scripts on SQL Server for all Stored Procedures
Add to zip
Upload zip to Web
WPF App I created that runs from client server downloads zip, extracts files to web app folder and executes scripts for sql server stored procedures
Now this does work but it requires an IT guy at the client end to run the WPF App to update and it can be days before some of them get round to it. So what I would like to do is provide the ability to update the web app from WITHIN the web app. I know I can create a DLL to do the FTP, Extract etc, but how can I get this to display progress on the page?
Or if anyone has an alternative to updating the web app without the need for someone to access the server it's on great as this method makes it hard to let clients know when there is an update available.
You can use i.e.
[assembly: PreApplicationStartMethod(typeof(Your.Type), "MethodNameToCall")]
which is specified in the AssemblyInfo.cs file of a project to do some setup code whenever the application is deployed. This automatically runs on deployment and would allow you to do your copying/setup. You could probably run the WPF App from this code via
System.Diagnostics.Process
UPDATE:
Having re-read this post it seems clear to me that this is about moving from a WPF app to a web based app. Also it appears the poster just wants a method by which to signal back from the code that is updating the file system on the client side so....
Depending on how complex the input required is you may need one or more pages and a navigation system to go forward and back.
However once all input had been taken and the update commenced you have a couple of options - one 'hacky' the other not so.
1 - Hacky) Refresh the page using window.location javascript and setTimeout along with session tracking to update the progress of the threaded coded behind EWWWWW...
2) Create an ajax function using setInterval to poll the server (probably using a callable method decorated with the [WebMethod] attribute. This method can send back arbitrary data back to the ajax call which is then used to update the UI (perhaps using something like jqueryUI progress bar
NOTE: IF you are replacing anything in the bin, touching the web.config or in fact ANY .aspx page. Then you will restart the server automatically... If this is the case then you will have to code a seperate application that will update the other application from the outside + you should signal to any connected users that a shutdown will occur shortly and start blocking new users until the upgrade has completed.

Resources