Skip to content

Commit b6ee986

Browse files
committed
updating new examples
1 parent 689872a commit b6ee986

19 files changed

Lines changed: 82 additions & 103 deletions

File tree

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# GCP Function Example
1+
# Google Cloud Function Example
22

33
This is an example of GCP function using Typescript and Yarn.
44

@@ -12,39 +12,47 @@ This is an example of GCP function using Typescript and Yarn.
1212

1313
At the first time running the project run the command:
1414

15-
$ yarn
15+
```bash
16+
$ yarn
17+
```
1618

1719
Then you can build and start the local dev:
1820

19-
$ yarn gcp:build
20-
$ yarn gcp:dev
21+
```bash
22+
$ yarn gcp:build
23+
$ yarn gcp:dev
24+
```
2125

2226
Once the project is running check out http://localhost:8081.
2327

2428
## Deploying to GCP
2529

2630
Deploy the GCP function (cd examples/with-gcp)
2731

28-
$ gcloud functions deploy gcp-function \
29-
--entry-point=handler \
30-
--runtime nodejs20 \
31-
--trigger-http \
32-
--allow-unauthenticated \
33-
--project [PROJECT ID]
34-
32+
```bash
33+
$ gcloud functions deploy gcp-function \
34+
--entry-point=handler \
35+
--runtime nodejs20 \
36+
--trigger-http \
37+
--allow-unauthenticated \
38+
--project [PROJECT ID]
39+
```
3540
access the URL (example): https://us-central1-zinc-style-449212-s0.cloudfunctions.net/gcp-function
3641

3742
## Authenticate for invocation
3843

3944
If authentication is required (--no-allow-unauthenticated), execute this line:
4045

41-
$ curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" \
42-
[FUNCTION URL]
46+
```bash
47+
$ curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" \
48+
[FUNCTION URL]
49+
```
4350

4451
more info: https://cloud.google.com/functions/docs/securing/authenticating
4552

4653
To invoke the GCP function directly, execute this line:
4754

48-
$ gcloud functions call [FUNCTION NAME]
49-
55+
```bash
56+
$ gcloud functions call [FUNCTION NAME]
57+
```
5058
more info: https://cloud.google.com/functions/docs/running/direct
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "ingest-with-gcp",
2+
"name": "ingest-with-google",
33
"version": "1.0.0",
44
"description": "A simple boilerplate for using Ingest with GCP functions.",
55
"main": "dist/handler.js",
@@ -9,8 +9,8 @@
99
"dev": "functions-framework --target=handler --port=8081"
1010
},
1111
"dependencies": {
12-
"@google-cloud/functions-framework": "^3.4.5",
13-
"@stackpress/ingest": "0.3.30"
12+
"@google-cloud/functions-framework": "3.4.5",
13+
"@stackpress/ingest": "0.3.31"
1414
},
1515
"devDependencies": {
1616
"@types/node": "22.9.3",

examples/with-lambda/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
"dev": "LAMBDA_LOCAL=true ts-node index.ts"
99
},
1010
"dependencies": {
11-
"@stackpress/ingest": "^0.3.31",
12-
"@types/aws-lambda": "^8.10.147",
13-
"@whatwg-node/server": "^0.9.67",
14-
"tslib": "^2.8.1"
11+
"@stackpress/ingest": "0.3.31",
12+
"@types/aws-lambda": "8.10.147",
13+
"@whatwg-node/server": "0.9.70",
14+
"tslib": "2.8.1"
1515
},
1616
"devDependencies": {
17-
"@types/node": "^22.13.1",
18-
"serverless-offline": "^14.4.0",
17+
"@types/node": "22.9.3",
18+
"serverless-offline": "14.4.0",
1919
"ts-node": "10.9.2",
20-
"typescript": "^4.9.5"
20+
"typescript": "5.7.2"
2121
}
2222
}

0 commit comments

Comments
 (0)