Skip to content

Commit 2c46f0c

Browse files
committedJun 28, 2020
Extract GRAPH_API_VERSION var and update to v7.0
1 parent e11b0ad commit 2c46f0c

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed
 

‎buildspec.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ env:
1717
TF_VAR_handler: "index.handler"
1818
REMOTE_STATE_BUCKET: "603-terraform-remote-state"
1919
REMOTE_STATE_REGION: "ap-southeast-2"
20+
GRAPH_API_VERSION: "v7.0"
2021
parameter-store:
2122
SPOTIFY_CLIENT_ID: "/scope-lex-handler/spotify-client-id"
2223
SPOTIFY_CLIENT_SECRET: "/scope-lex-handler/spotify-client-secret"

‎infrastructure/README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Scope-lex-handler is a Lambda function built, tested and deployed to AWS by Code
44

55
---
66

7-
### Deployment Prerequisites
7+
## Deployment Prerequisites
88

99
**All commands below must be run in the /infrastructure directory.**
1010

@@ -17,18 +17,20 @@ To deploy to AWS, you must:
1717
1. Run on an EC2 instance with an IAM Role.
1818
1. Run via CodeBuild or ECS Task with an IAM Role (see [buildspec-test.yml](../buildspec-test.yml) for workaround)
1919

20-
#### Deploying infrastructure
20+
### Deploying infrastructure
2121

2222
1. Update and export all environment variables specified in the appropriate buildspec declaration (check all phases) and bash scripts
2323
1. Initialise Terraform:
24-
```
24+
25+
```terraform
2526
terraform init \
2627
-backend-config 'bucket=YOUR_S3_BUCKET' \
2728
-backend-config 'key=YOUR_S3_KEY' \
2829
-backend-config 'region=YOUR_REGION' \
2930
-get=true \
3031
-upgrade=true
3132
```
33+
3234
1. `terraform plan -out main.tfplan`
3335
1. `terraform apply main.tfplan`
3436

@@ -37,27 +39,31 @@ terraform init \
3739
1. Update and export all environment variables specified in the appropriate buildspec declaration (check all phases) and bash scripts
3840
1. Make necessary infrastructure code changes.
3941
1. Initialise Terraform:
40-
```
42+
43+
```terraform
4144
terraform init \
4245
-backend-config 'bucket=YOUR_S3_BUCKET' \
4346
-backend-config 'key=YOUR_S3_KEY' \
4447
-backend-config 'region=YOUR_REGION' \
4548
-get=true \
4649
-upgrade=true
4750
```
51+
4852
1. `terraform plan -out main.tfplan`
4953
1. `terraform apply main.tfplan`
5054

5155
#### Destroying infrastructure (use with care)
5256

5357
1. Update and export all environment variables specified in the appropriate buildspec declaration (check all phases) and bash scripts
5458
1. Initialise Terraform:
55-
```
59+
60+
```terraform
5661
terraform init \
5762
-backend-config 'bucket=YOUR_S3_BUCKET' \
5863
-backend-config 'key=YOUR_S3_KEY' \
5964
-backend-config 'region=YOUR_REGION' \
6065
-get=true \
6166
-upgrade=true
6267
```
63-
1. `terraform destroy`
68+
69+
1. `terraform destroy`

‎infrastructure/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
terraform {
22
required_version = ">= 0.12"
3-
}
3+
}

‎src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export async function getUserProfile(userId: string, bot: LexBot): Promise<UserP
4444
}
4545

4646
try {
47-
const url = `https://graph.facebook.com/v3.2/${userId}?access_token=${process.env.PAGE_ACCESS_TOKEN}`;
47+
const url = `https://graph.facebook.com/${process.env.GRAPH_API_VERSION || 'v7.0'}/${userId}?access_token=${process.env.PAGE_ACCESS_TOKEN}`;
4848

4949
const requestHeaders = new Headers();
5050
requestHeaders.append('Content-Type', 'application/json');

0 commit comments

Comments
 (0)
Please sign in to comment.