Posts

Cypress Connection Refused Error

 I had a case where I need to call an api then visit the app in Cypress and it turns out to be causing an issue with the following error message: Error: connect ECONNREFUSED 127.0.0.1:4200 It turns out to be Cypress' origin safety issue. I wrapped the cy.request() with cy.origin() and that solves the issue with a catch. If I call cy.origin() before I call cy.visit() then it doesn't work somehow. If I call cy.visit() first and then cy.origin() then it works fine. Also, if after code change, it doesn't appear to work, restart cypress app (or test runner if using older version).  I had the case where I call cy.origin() first, then cy.visit() which doesn't work, make the change to call cy.visit() first without restarting the app and it still doesn't work. But it works after I restarted cypress app.

Playwright Intermittent Connection Refused Error

As I have more tests in Playwright, the number of workers required grow and I happened to encounter the following error: Error: page.goto: NS_ERROR_CONNECTION_REFUSED And the tests that failed changes every time playwright test is run. To solve this, I reduce the workers in playwright.config.ts. from: workers: process.env.CI ? 1 : undefined, to: workers: process.env.CI ? 1 : 8, //8 works fine for me. I will go smaller like 4 or 5 if the issue persists. This defines the max workers Alternatively, workers can be set when running the test. npx playwright test --workers 8 For more information: https://playwright.dev/docs/test-parallel#limit-workers

Lambda Times Out When Getting Object from S3

 I had the issue where Lambda function launched in private network times out when trying to get object from S3 bucket. Typically, there are two solutions: Use S3 VPC endpoint (either gateway or interface) since it resolves s3 endpoint to private IP. Attach public IP. This is done using NAT Gateway with Elastic IP (EIP). The problem is, in my case, the S3 bucket is in different region, different account, than the Lambda function while the first solution, even though S3 is a global service, the VPC endpoint can't resolve to S3 in different region. In short, the first solution only works when S3 bucket and Lambda function are in the same region. That left us with solution 2 which is more expensive but works. Also I need to make sure that the S3 bucket policy allows cross account access.

OpenSearch Container Unreachable in ECS

So, I have to launch Opensearch in ECS. And I need to add persistent storage. The container ran fine but it threw AccessDeniedException. And even though the container ran, my application was unable to connect to it.  After few tries, I found out that it is due to the permission of the directory where the data are supposed to reside. The container runs in ECS on EC2. The path, in this case, I use /usr/share/opensearch/data on EC2 is owned by root, but the container runs as ec2-user. So, I had to update the user data field on the launch template (since I used ASG) to include the following commands: mkdir -p /usr/share/opensearch/data sudo chown 1000:1000 /usr/share/opensearch/data That fixed the exception and the reachability issue.

Sentinel One Strikes Again. No internet connection. Uninstall Sentinel One Agent.

This happened to a co-worker of mine a while back when his test application file was marked as suspicious by Sentinel One antivirus and had his internet on his laptop disabled. Today, it happened to me without any suspicious file. Probably suspicious activity, who knows. On Microsoft Edge, it says "Hmmm... your Internet access is blocked.", "Firewall or antivirus software may have blocked the connection", and "ERR_NETWORK_ACCESS_DENIED". So, I worked with my IT to uninstall the agent, but uninstalling is not without a fight. Here are the steps that I took: Since it is a Windows 11 machine with Bitlocker, I have to first get the Bitlocker key. From command prompt run: manage-bde -protectors -get C: After I verified it is the same key that the IT has, I saved the key outside of the machine. Then go to system configuration by searching for "sysconfig" or run msconfig. Under "boot" tab, check the "Safe boot" option, then click ...

Error When Generating OpenAPI Documents: Missing required option '--project'

After I installed Microsoft.Extensions.ApiDescription.Server package, I encountered the following error message when I attempted to generate OpenAPI documents at build-time on .NET 9. Missing required option '--project' The command "dotnet "..."" exited with code 1 Apparently, it was due to end slash on my attempt to change the output directory. On my csproj file, I have the following entry: <PropertyGroup> <OpenApiDocumentsDirectory>../directory/</OpenApiDocumentsDirectory> </PropertyGroup> It works correctly after I removed the end slash: <PropertyGroup> <OpenApiDocumentsDirectory>../directory</OpenApiDocumentsDirectory> </PropertyGroup>

Logitech Mouse and Keyboard do not Work

I found a Logitech mouse and keyboard combo on clearance. The model is MK470 and it looks returned. For the steep discounted price, I decided to give a try. Expectedly, it didn't work, so that starts my troubleshooting. Battery is fine, no on/off button on keyboard, both mouse and keyboard are not working, no sign of damage, dongle is properly inserted into the USB port. Short while later, I found that Logitech has a neat Connection Utility software . I downloaded it and ran it twice, once to reconnect the mouse and once for the keyboard. My guess is the frequency and channel somehow was not lining up between the mouse and keyboard and the dongle. The previous buyer probably returned it because they were not working. But the connection is finally restored.