Serverless Stuck Unable to Create Domain - aws-serverless

I have a Lambda service that was created with Serverless. I recently upgraded to Serverless 3. (3.22.0 specifically.) I'm also using serverless-offline 8.8.1 and serverless-domain-manager 4.2.3.
It seems to be "stuck" in a state where the domain cannot be deleted or re-created.
After the upgrade, publishing to my prod stage would fail with:
Serverless Domain Manager: Info: api-prod.example.com: Found apiId: pnedwg0m9b
Serverless Domain Manager: Error: api-prod.example.com: ConflictException: Base path already exists for this domain name
Serverless Domain Manager: Error: api-prod.example.com: Error: Error: api-prod.example.com: Unable to create basepath mapping.
...
Error: Error: Unable to setup base domain mappings for api-prod.example.com
The domain settings in serverless.yml look like this:
custom:
customDomain:
domainName: api-${opt:stage, 'dev'}.example.com
basePath: ''
stage: ${self:provider.stage}
createRoute53Record: true
After searching online, I thought the issue might be that the domain was created with an older version of serverless, so I manually deleted it in the Route53 section of the AWS console, then waited overnight. It doesn't appear in the console now.
I tried to re-create it by doing both:
Having createRoute53Record: true in the serverless.yml and running:
SLS_DEBUG=* serverless deploy --verbose --stage prod
This gives the same "unable to setup base domain mapping..." error as before.
... and also manually creating it:
SLS_DEBUG=* serverless create_domain --verbose --stage prod
That just gives the following error, despite the fact that the domain is not visible in the AWS console:
Custom domain api-prod.example.com already exists.
If I try to delete it via serverless, it also throws an error:
SLS_DEBUG=* serverless delete_domain --verbose --stage prod
Serverless Domain Manager: Error: api-prod.example.com: InvalidChangeBatch: [Tried to delete resource record set [name='api-prod.example.com.', type='A'] but it was not found, Tried to delete resource record set [name='api-prod.example.com.', type='AAAA'] but it was not found]
Serverless Domain Manager: Error: api-prod.example.com: Error: Error: Failed to DELETE A Alias for api-prod.example.com
Some other notes:
The "development" stage doesn't result in any errors when deploying. (I created the domain with the create_domain command, but even with createRoute53Record:true, it deploys without error.)
I've tried bumping serverless-domain-manager to 6.1, but that didn't help.
The api-prod.example.com is not present in neither Route53 nor in API Gateway>Custom domain names.
Not sure if it's relevant but this same API was exposed by both api-prod.example.com and api.example.com. I'm not sure how the api.example.com one was created.

Related

Error validating datasource `db`: the URL must start with the protocol `mongo`

ERROR PrismaClientInitializationError: Invalid
`prisma.chat.findMany()` invocation:error: Error
validating datasource `db`: the URL must start with the
protocol `mongo`.
--> schema.prisma:10
| 9 | provider = "mongodb"
10 | url = env("DATABASE_URL")
| Validation Error Count: 1
Different type of methods I've tried so far:
Renaming mongodb to mongo in database URL
Removing the quotes in vercel enviroment variables
adding the enviroment variable to vercel.json
All my environment variables are already in my vercel environments for my project
Works perfectly fine in Dev -> Build -> Start in vscode.
How do you deploy on vercel with prisma mongodb URL error?
Ive seen the same error for others but with different db.
You need to define your environment variables in Vercel. Vercel won't have access to your local .env file.

Gitlab CI: Access private repository from CI pipeline fails

I try to set up a Gitlab CI configuration, which executes the unit tests of a symfony project. The same configuration works for an old project, but in my new one the command composer update fails. The error message says that it isn’t possible to clone our own bundle out of our Gitlab.
$ composer update
Loading composer repositories with package information
In Git.php line 471:
Failed to execute git clone --mirror -- ‘https://glp...XXX:private-token#gi
tlab.company.com/bundle/test-bundle.git’ ‘/tmp/cache/vcs/https---gitla
b.company.com-bundle-test-bundle.git/’
Cloning into bare repository ‘/tmp/cache/vcs/https---gitlab.company.com-bundle-test-bundle.git’...
fatal: unable to access ‘https://gitlab.company.com/bundle/test-bundle
.git/’: Failed to connect to gitlab.company.com port 443 after 0 ms: Conn
ection refused
At first I tried to use a personal access token in my .gitlab-ci.yaml but get the previous mentioned error.
test:
image: composer:latest
stage: test
before_script:
- composer config gitlab-token.gitlab.company.com $PERSONAL_CI_TOKEN
After that I tried the access by username/password.
echo "{\"http-basic\":{\"gitlab.company.com\":{\"username\":\"user\",\"password\":\"password\"}}}” > $HOME/.composer/auth.json
All the possibilities worked in my composer docker container and in my other project the access is still possible. I don't know how to solve this error.
Please check if you have added your self-hosted gitlab domain in your config in the composer.json file.
It should look like this:
"config": { "gitlab-domains": ["gitlab.company.com"] }

Apify with Python : Account authorization key not found in the system

I was trying the free trial version of recaptcha solver by apify for the following page https://www.google.com/recaptcha/api2/demo
Input :
{
"key": "apify_api_KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK",
"webUrl": "https://www.google.com/recaptcha/api2/demo",
"siteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
}
I tried running the same with the above inputs, but I get the error
2022-08-14T10:13:34.970Z ACTOR: Pulling Docker image from repository.
2022-08-14T10:13:35.109Z ACTOR: Creating Docker container.
2022-08-14T10:13:35.168Z ACTOR: Starting Docker container.
2022-08-14T10:13:36.323Z
2022-08-14T10:13:36.327Z WARNING: The npm start script not found in package.json. Using "node main.js" instead. Please update your package.json file. For more information see https://github.com/apifytech/apify-cli/blob/master/MIGRATIONS.md
2022-08-14T10:13:36.330Z
2022-08-14T10:13:38.579Z Solving re-captcha with Anticaptcha: https://www.google.com/recaptcha/api2/demo
2022-08-14T10:13:38.780Z User function threw an exception:
2022-08-14T10:13:38.782Z Account authorization key not found in the system
You need to have an anti-captcha subscription to be able to use it. https://apify.com/petr_cermak/anti-captcha-recaptcha
"key": ANTI_CAPTCHA_KEY
You trying to use Apify API key to authorize access to anti-captcha.com service, it fails with error Account authorization key not found in the system

AWS Amplify build failing - Failed to get profile: Profile configuration is missing for: amplify

I have an AWS-Amplify project that had been building without a problem but is now failing.
# Starting phase: build
2021-11-20T00:40:02.506Z [INFO]: [31mFailed to get profile: Profile configuration is missing for: amplify[39m
2021-11-20T00:40:02.564Z [ERROR]: !!! Build failed
2021-11-20T00:40:02.564Z [ERROR]: !!! Non-Zero Exit Code detected
2021-11-20T00:40:02.564Z [INFO]: # Starting environment caching...
2021-11-20T00:40:02.565Z [INFO]: # Environment caching completed
Terminating logging...
The problem seemed to start after I made an error doing a pull request (in the wrong direction!), however, the problem has persisted despite reverting back to an earlier commit.
I have also ensured all the Amplify code is up to date amplify pull, as well as trying amplify configure and amplify init on my development machine.
Other posts that describe problems with 'Profile Configuration' seem to be related to the development machine and setting up the CLI. This failure is happening when I try to build on AWS using continuous deploys, building locally works fine.
so i got it to work.
Just delete the aws-exports.json and the amplify folder.
Then run the command from amplify which is something like:
amplify pull --appId XXXXXXXXXXX --envName dev
After a few mins, it will prompt you to select:
AWS PROFILE
AWS KEYS
select AWS KEYS
enter credentials for a programmatic user and it should be fine

SBT not passing credentials when publishing to Artifactory

I am coding a Java project and I'm automating the build and the publishing to JFrog Artifactory using SBT.
Whenever it's time to publish to Artifactory I want to do it using the Ivy directory layout and obviously publish the Ivy XML file along with the jar. I managed to achieve this by using the following lines in the build.sbt file:
crossPaths := false
publishTo := Some("Artifactory Realm" at "http://<Artifactory IP>:<Artifactory Port>/artifactory/org.project.my")
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
publishMavenStyle := false
However it only works when anonymous users are allowed to deploy into Artifactory. I realized that sbt is not really passing my credentials to Artifactory but, instead, logging in as anonymous.
My $HOME/.ivy2/.credentials file looks like this:
realm=Artifactory Realm
host=http://<Artifactory IP>:<Artifactory Port>/artifactory/org.project.my
user=<my user name>
password=<my user name>
However, if I change the Artifactory configuration in order to prevent anonymous users from deploying new Artifacts, when I run "sbt publish" I get the following output:
[error] Unable to find credentials for [Artifactory Realm # <Artifactory IP>].
java.io.IOException: Access to URL http://<Artifactory IP>:<Artifactory Port>/artifactory//org.project.my/org/project/my/project-my/1.0.0/project-my-1.0.0.jar was refused by the server: Unauthorized
The Artifactory request.log file then contains:
20160219011657|319|REQUEST|10.0.2.2|anonymous|PUT|/org.project.my/org/project/my/project-my/1.0.0/project-my-1.0.0.jar|HTTP/1.1|401|24978
I have also tried passing the credentials manually instead of using a file:
credentials += Credentials("Artifactory Realm", "localhost", "<USERNAME>", "<PASS>")
But I am getting the same result.
Any idea what I might be missing?
try:
host=<Artifactory IP>
old answer (doesn't work):
host=<Artifactory IP>:<Artifactory port>
I had a different problem: I had the wrong realm set on my .credentials file.
Looking at the error output from sbt, I was able to figure out that I should use:
realm=Artifactory Realm
Error shows the expected values for realm and host:
[error] Unable to find credentials for [Artifactory Realm # myhost].

Resources