XML file present in visual Studio Azure Function Solution Not getting published to Azure - visual-studio-2017

I've created an Azure function which reads the data from xml file. In local everything is working fine. When I'm publishing the project to Azure, I'm getting the below error on Azure logs.
Could not find file 'D:\Windows\system32\xxxx.xml
When I checked wwwroot directory on Azure, this file was not available there. Can you please let me know how to publish this xml file to Azure?

Make sure you set your xml file to "Always copy" in the Copy to Output section:
To actually read that file within your Function, you need to first get the current Function working directory. This is done by getting the ExecutionContext, something like this:
public static HttpResponseMessage Run(HttpRequestMessage req, TraceWriter log, ExecutionContext context)
{
var filePath = Path.Combine(context.FunctionAppDirectory, "XMLFile1.xml");
}

Related

AWS Lambda - Unable to access the files and folder from lambda layer

I have a lambda function written in .NET 6 to which I have attached a lambda layer which is a zip file with many JSON files and folders in it.
I want to read each JSON file in my lambda function.
When I do this I get an error saying Could not find a part of the path '/var/task/geojson-files/UK.json':
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "geojson-files", "UK.json");
var geojson = await File.ReadAllTextAsync(filePath);
I also tried /opt/geojson-files/UK.json. But still unable to read the file.
Is there any way to read the file in a lambda function from a lambda layer?
Thanks to #jarmod for his suggestion in the comments to enumerate the contents of /opt
I iterated over the /opt folder and could get the root cause of my problem i.e. unable to read files from the lambda layer.
I zipped the contents of geojson-files from inside that folder. So when I enumerated /opt, I could directly see /opt/UK.json file. So then I zipped the geojson-files folder and now I can see /opt/geojson-files/UK.json file.

Azure Data Factory HDFS dataset preview error

I'm trying to connect to the HDFS from the ADF. I created a folder and sample file (orc format) and put it in the newly created folder.
Then in ADF I created successfully linked service for HDFS using my Windows credentials (the same user which was used for creating sample file):
But when trying to browse the data through dataset:
I'm getting an error: The response content from the data store is not expected, and cannot be parsed.:
Is there something I'm doing wrongly or it is kind of permissions issue?
Please advise
This appears to be a generic issue, you need to point to a file with appropriate extension rather than a folder itself. Also make sure you are using a supported data store activity.
You can follow this official MS doc to use HDFS server with Azure Data Factory

Springboot server in Elastic Beanstalk creates files that I can't see

I have a Springboot server that is deployed to an Elastic Beanstalk environment in AWS. The basic functionality is this:
1. Upload a file to the server
2. The server processes file by doing some data manipulation.
3. Then the file that is created is sent to a user via email.
The strange thing is that, the functionality mentioned above is working. The output file is sent to my email inbox successfully. However, the file cannot be seen when SSHed into the instance. The entire directory that gets created for the data manipulation is just not there. I have looked everywhere.
To test this, I even created a simple function in my Springboot Controller like this:
#GetMapping("/")
public ResponseEntity<String> dummyMethod() {
// TODO : remove line below after testing
new File(directoryToCreate).mkdirs();
return new ResponseEntity<>("Successful health check. Status: 200 - OK", HttpStatus.OK);
}
If I use Postman to hit this endpoint, the directory CANNOT be seen via the terminal that I am SSHed into. The program is working so I know that the code is correct in that sense, but its like the files and directories are invisible to me.
Furthermore, if I were to run the server locally (using Windows OR Linux) and hit this endpoint, the directory is successfully created.
Update:
I found where the app lives in the environment at /var/app. But my folders and files are still not there, only the source code files, ect are there. The files that my server is supposed to be creating are still missing. I can even print out the absolute path to the file after creating it, but that file still doesn't exist. Here is an example:
Files.copy(source, dest);
logger.info("Successfully copied file to: {}", dest.getAbsolutePath());
will print...
Successfully copied file to: /tmp/TESTING/Test-Results/GVA_output_2021-12-13 12.32.58/results_map_GVA.csv
That path DOES NOT exist in my server, but I CAN send it to me via email from the server code after being processed. But if I SSH into the instance and go to that path, nothing is there.
If I use the command: find . -name "GVA*" (to search for the file I am looking for) then it prints this:
./var/lib/docker/overlay2/fbf04e23e39d61896a1c935748a63f2d3836487d9b166bae490764c30b8870ae/diff/tmp/TESTING/Test-Results/GVA_output_2021-12-09 18.15.59
./var/lib/docker/overlay2/fbf04e23e39d61896a1c935748a63f2d3836487d9b166bae490764c30b8870ae/diff/tmp/TESTING/Test-Results/GVA_output_2021-12-13 12.26.34
./var/lib/docker/overlay2/fbf04e23e39d61896a1c935748a63f2d3836487d9b166bae490764c30b8870ae/diff/tmp/TESTING/Test-Results/GVA_output_2021-12-13 12.32.58
./var/lib/docker/overlay2/fbf04e23e39d61896a1c935748a63f2d3836487d9b166bae490764c30b8870ae/merged/tmp/TESTING/Test-Results/GVA_output_2021-12-09 18.15.59
./var/lib/docker/overlay2/fbf04e23e39d61896a1c935748a63f2d3836487d9b166bae490764c30b8870ae/merged/tmp/TESTING/Test-Results/GVA_output_2021-12-13 12.26.34
./var/lib/docker/overlay2/fbf04e23e39d61896a1c935748a63f2d3836487d9b166bae490764c30b8870ae/merged/tmp/TESTING/Test-Results/GVA_output_2021-12-13 12.32.58
But this looks like it is keeping track of differences between versions of files since I see diff and merged in the file path. I just want to find where that file is actually residing.
If you need to store an uploaded file somewhere from a Spring BOOT app, look at using an Amazon S3 bucket as opposed to writing the file to a folder on the server. For example, assume you are working with a Photo app and the photos can be uploaded via the Spring BOOT app. Instead of placing this in a directory on the server, use the Amazon S3 Java API to store the file in an Amazon S3 bucket.
Here is an example of using a Spring BOOT app and handling uploaded files by placing them in a bucket.
Creating a dynamic web application that analyzes photos using the AWS SDK for Java
This example app also shows you how to use the SES API to send data (a report in this example) to a user via email.

Test data to requests for Postman monitor

I run my collection using Test data from a csv file, However there is no option to upload the test data file when adding monitor for the collection. On searching through internet could see that the test data file have to be provided in URL (saved in cloud ..google drive,.). But i couldn't get source for how to provide this URL to the collection . Can anyone please help
https://www.postman.com/praveendvd-public/workspace/postman-tricks-and-tips/request/8296678-d06b3fc0-6b8b-4370-9847-aee0f526e7db
you cannot use csv file in monitor , but could store the content of csv as variable and use that to drive the monitor . An example can be seen in the above public repository

FinalBuilder 7 - Where are log files?

i did found a file named XXX.fbl7 which is type is named "FinalBuilder Log File".
if this is the file how can i open it?
once i click it from windows explorer i get "The project file specified on the command line was not found or invalid"
In the desktop application, Tools->Options->Logging section there is tab that allows you to export the logs to text, xml and HTML.
In a Final Builder Project, you can also use a Final Builder Action to create a separate log file in the format you want.
Personally I just use the Final Builder Server Notification options to let me know when things have failed, then go to the web server and review the full log in the web page.
Final Builder log files are binary files. You can't open them without having the product installed. As far as I remember, there was an option to export them as text files. But I haven't used FB for years, so I might be wrong.