Access denied to AWS SQS via NodeJS SDK (aws-sdk-js) (SUDDENLY!!) - node.js

First of all, I know there are similar questions here at SO. Also I
want to let you know I have already found out what the problem was.
Just want to share the solution with others who is potentially looking
for the solution of the same problem... And no, it's not a duplicate
topic.
Few days ago, my NodeJS script stopped working with AWS SQS suddenly!
Access to the resource https://sqs.us-west-2.amazonaws.com/ is denied.
But what was interesting, when I tested SQS via aws-cli with appropriate profile, it worked!
I spent many hours searching and trying to find solution... Typical problem of other programmers here at StackOverflow (for example like here) is pretty obvious: wrong IAM policy or wrong credentials. But everything worked for me few days ago and not now?! It brought me crazy.
Spoiler alert! Well, at the end, the problem was really about wrong credentials. But how is it possible when nothing has been changed on our side, right?
I found similar question at AWS Developer forum - I started playing with IAM policies but no change.
Ok, so what has happened? See my answer below

Ok, so what has happened?
Around Oct 17, 2018, you can find "Feature/load shared config" in aws-sdk-js commit history. It's a version v2.337.0+. I didn't read the code but it seems that since that time (and version), the priority of getting AWS credentials has changed. Before that, it seems environment variables had bigger priority than config file. But not anymore! What does it mean?
Well, in my case, I have several profiles in .aws/credentials and my default profile IS NOT the one with full access permissions. If your default profile has AdministratorAccess policy, this problem is not relevant for you!
I use profiles in the config file for aws-cli and not for the script. In my script, I use environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
Do you see the problem now? Before the change of SDK, it worked, because SDK chose environment variables first. But since some logic has changed within SDK, it chose default profile from config file. And as I wrote earlier, my default profile couldn't access SQS!
So, my solution was to remove (rename) default profile from config file. And because there was no default profile anymore, SDK started to use my environment variables again.
Glory to the SDK!

Related

Change Azure VM Time (not timezone) running Windows Server 2022

I would like to change an Azure server's local time to a month ago. This is for testing purposes on a custom application. Happy if it changes back after reboot.
There are a number of similar posts with answers, but most either refer to changing the timezone, or are old(ish) posts whose answers are not valid anymore. Not sure if Microsoft has made some changes.
What I have tried to to stop the Hyper-V Time Synchronization service as well as the Windows Time service, but to no avail. I also wrote a small c# program to try and do this, but no success.
Anything else that might work?
Thank you DeepDave-MT . Posting your recommendation into answer section as per Cameron Castillo confirmation. This would help other community members.
Steps to change time settings in Local Server section of the Server Manager:
Open the time and date settings in the Local Server section of the Server Manager.
from the opened time manager window, make the required changes.

Access Core Data from extension without provisioning profile on macOS?

I'd like to add a Quick Look extension to my program, but in order to be useful, it would have to access the Core Data stack, which seems to require me to add an App Group and a provisioning profile to the project.
Until now, it has been possible for anyone to download the project from Github and compile and run it out of the box. All project targets are set to Team: None and Sign to Run Locally. If I add my provisioning profile to the project, this will no longer work. They will have to create and add their own provisioning profile and change the Signing & Capabilities settings on each of the 26 targets (there seems to be no way to do them all at once). And the profile will have to be renewed every year.
My question is, is there any way around this? Is such a major change really necessary for what amounts to accessing a file inside the program's own bundle (and another in its Application Support folder?)
EDIT: As was pointed out to me on the Apple Developer forum, you don't need a provisioning profile as long as you prefix the group name with the development team identifier. This still won't make it build out of the box, though. You will still need a developer account and set a team on every target.
I had missed that you are supposed to have a team identifier as the prefix for the group name. That still doesn't solve the problem that my project will no longer build out of the box for anyone who downloads it from Github, but it answers the question asked in the subject line.

Querying available locations in Azure SDK for node

I would like to list the locations available for a particular subscription, pretty much in the same way that it's done with az account list-locations from the command line, or like it's listed here for Python
However, I can't find a straighforward way to do that. The example here apparently creates a virtual machine, but is not too well documented.
I can't even get past the initial step of providing credentials to use my account (this could be it, but it's geared towards working with compute service; I don't know how it can be translated into simple management).
Is there any step-by-step tutorial I have missed?
The azure-mgmt package seems clear enough, but it seems also a bit outdated and it's not clear if it's current anymore.
Pretty sure you need this to auth: https://learn.microsoft.com/es-es/javascript/api/azure-arm-resource/subscriptionclient?view=azure-node-latest
and this call to get locations: https://learn.microsoft.com/es-es/javascript/api/azure-arm-resource/locationlistresult?view=azure-node-latest
Node SDK repo: https://github.com/Azure/azure-sdk-for-node

Debugging Azure Worker Role locally throws build error: Access to the path 'diagnostics.wadcfgx' is denied

I have a fully functional cloud service Worker Role that I have been using and debugging for a couple weeks now. I recently moved the solution into source control. I can build the solution still, but when I try to run it locally on the emulator to debug I get the error
Access to the path 'diagnostics.wadcfgx' is denied.
I have everything checked out to edit so I know it isn't a read only issue on the file. I can't figure out why this is happening or how to fix it.
My old version still runs locally on the emulator just fine. I have modified the projects in the solution and updated naming conventions of the roles and projects. My guess is that something was missed or a connection between the role project and the service project was lost... however I cannot figure out what it is.
Any ideas would be greatly appreciated.
My problem ended up being that one of the diagnostics.wadcfgx files was still marked as read only in the file system. The best solution was to remove the entire ECF folder from source control. When the project ran it recreated the directory and files needed.

Azure Compute Emulator will not start

I have recently upgraded to the new Azure SDK (September 2011 v 1.5).
Ever since I have not been able to start the compute emulator. Consequently I can't debug the services on my local machine.
I have seen a suggestion that the problem lies with the fact that my user account has a space in it, so I renamed my account but that didn't make any difference. It may be that the problem is that my user profile path has a space in it. Changing the account name has no effect no the profile path.
On the msdn forums it was suggested that I remove *:808 binding in IIS Manager for Default Website. See MSDN Forums
Anyone have any other ideas?
Another option:
So, given the "rename your user account/regedit doesn't work for you, you may want to look at this MSDN article, which suggests you can just set an environment variable and run the emulator without mucking with the registry... not sure if setting the environment variable globally would let you run automatically within VS.NET without manually starting up the emulator the first time, but it is certainly easier.
Yes, the space(s) in your profile path are the issue, and this appears to be a regression for a bug that was found in a previous version of the emulator (the only reason I even thought to try logging in with a different account in the first place). I was literally just putting together a quick blog post here describing the same issue. You'll need to do some registry editing to fix all the references to your old profile path if you want to fix it, or just create a new user if you can deal with re-installing software (I love the Web Platform Installer, but I found out during this exercise that it doesn't do a good job installing for "all users").

Resources