Skip to content

Commit b1e1021

Browse files
authored
aligned text
1 parent 1e1edae commit b1e1021

File tree

1 file changed

+60
-59
lines changed
  • src/pages/gen1/[platform]/build-a-backend/troubleshooting/apikey-not-found

1 file changed

+60
-59
lines changed

src/pages/gen1/[platform]/build-a-backend/troubleshooting/apikey-not-found/index.mdx

Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -30,82 +30,83 @@ If you're encountering an "API Key Not Found" issue in your Amplify project, fol
3030

3131
## Step 1: Modify `parameters.json` to Remove API Key
3232

33-
1. Navigate to the `amplify/backend/api/<apiName>/parameters.json` file in your project.
34-
2. Add the following line to the file:
33+
1. Navigate to the `amplify/backend/api/<apiName>/parameters.json` file in your project.
34+
2. Add the following line to the file:
3535

36-
```tsx title="parameters.json"
37-
{
38-
"CreateAPIKey": 0
39-
}
40-
```
41-
Ensure that a comma is placed after the previous line if this is added at the end of the JSON object.
36+
```json title="parameters.json"
37+
{
38+
"CreateAPIKey": 0
39+
}
40+
```
41+
Ensure that a comma is placed after the previous line if this is added at the end of the JSON object.
4242

4343
## Step 2: Remove API Key from Lambda Function Attributes
4444

45-
1. Open the `amplify/backend/backend-config.json` file.
46-
2. Locate any JSON attribute arrays that include `GraphQLAPIKeyOutput`.
47-
3. Modify the arrays by removing the `GraphQLAPIKeyOutput` entry. For example:
48-
* Change this:
49-
50-
```tsx title="backend-config.json"
51-
{
52-
"attributes": [
53-
"GraphQLAPIIdOutput",
54-
"GraphQLAPIEndpointOutput",
55-
"GraphQLAPIKeyOutput"
56-
]
57-
}
58-
```
59-
60-
* To this:
61-
62-
```tsx title="backend-config.json"
63-
{
64-
"attributes": [
65-
"GraphQLAPIIdOutput",
66-
"GraphQLAPIEndpointOutput"
67-
]
68-
}
69-
```
70-
Perform this change for each Lambda function that utilizes the API.
45+
1. Open the `amplify/backend/backend-config.json` file.
46+
2. Locate any JSON attribute arrays that include `GraphQLAPIKeyOutput`.
47+
3. Modify the arrays by removing the `GraphQLAPIKeyOutput` entry. For example:
48+
49+
* Change this:
50+
51+
```json title="backend-config.json"
52+
{
53+
"attributes": [
54+
"GraphQLAPIIdOutput",
55+
"GraphQLAPIEndpointOutput",
56+
"GraphQLAPIKeyOutput"
57+
]
58+
}
59+
```
60+
61+
* To this:
62+
63+
```json title="backend-config.json"
64+
{
65+
"attributes": [
66+
"GraphQLAPIIdOutput",
67+
"GraphQLAPIEndpointOutput"
68+
]
69+
}
70+
```
71+
Perform this change for each Lambda function that utilizes the API.
7172

7273

7374
## Step 3: Apply the Changes
7475

75-
1. Push the changes to the cloud:
76+
1. Push the changes to the cloud:
7677

77-
```sh
78-
amplify push -y
79-
```
80-
Once this process is complete, the API key should be removed from both the application and the associated Lambda functions.
78+
```sh
79+
amplify push -y
80+
```
81+
Once this process is complete, the API key should be removed from both the application and the associated Lambda functions.
8182

8283
## Step 4: Restore the API Key
8384

84-
1. Remove the `CreateAPIKey: 0` entry from `amplify/backend/api/<apiName>/parameters.json`.
85-
2. Push the changes to restore the API key to the application:
85+
1. Remove the `CreateAPIKey: 0` entry from `amplify/backend/api/<apiName>/parameters.json`.
86+
2. Push the changes to restore the API key to the application:
8687

87-
```sh
88-
amplify push -y
89-
```
90-
After this step, the API key should be restored to the application but will not be associated with the Lambda functions.
88+
```sh
89+
amplify push -y
90+
```
91+
After this step, the API key should be restored to the application but will not be associated with the Lambda functions.
9192

9293

9394
## Step 5: Update Lambda Function Resources
9495

95-
1. Use the following command to update each Lambda function that was previously associated with the API:
96+
1. Use the following command to update each Lambda function that was previously associated with the API:
9697

97-
```sh
98-
amplify update function
99-
```
100-
2. Follow the prompts to remove the API from the Lambda’s resources.
101-
3. Use the same command to restore the API to each Lambda function:
98+
```sh
99+
amplify update function
100+
```
101+
2. Follow the prompts to remove the API from the Lambda’s resources.
102+
3. Use the same command to restore the API to each Lambda function:
102103

103-
```sh
104-
amplify update function
105-
```
106-
4. Finally, push the changes to apply them:
104+
```sh
105+
amplify update function
106+
```
107+
4. Finally, push the changes to apply them:
107108

108-
```sh
109-
amplify push -y
110-
```
111-
This should complete the process and resolve the "API Key Not Found" issue.
109+
```sh
110+
amplify push -y
111+
```
112+
This should complete the process and resolve the "API Key Not Found" issue.

0 commit comments

Comments
 (0)