Skip to content

Commit 66c7b79

Browse files
chore(examples): Fix functions examples + add google oauth (#31953)
Co-authored-by: LekoArts <[email protected]>
1 parent 6edfc22 commit 66c7b79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+574
-224
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
AIRTABLE_KEY=
2+
AIRTABLE_DB=

examples/functions-airtable-form/README.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424

2525
3. **Start developing.**
2626

27-
To get started, run `yarn` to add all necessary packages.
27+
To get started, run `npm install` to add all necessary packages.
2828

29-
When developing locally, you'll want to include the ENV variables in your `.env.development`. Read more about how Gatsby handles `.env` files and environment variables in the [Gatbsy Docs](https://www.gatsbyjs.com/docs/how-to/local-development/environment-variables/)
29+
When developing locally, you'll want to include the ENV variables in your `.env.development`. Read more about how Gatsby handles `.env` files and environment variables in the [Gatsby Docs](https://www.gatsbyjs.com/docs/how-to/local-development/environment-variables/)
3030

3131
```shell
32-
cd airtable-form
33-
yarn
34-
yarn run develop
32+
cd examples/functions-airtable-form
33+
npm install
34+
npm run develop
3535
```
3636

3737
4. **Open the code and start customizing!**
@@ -53,15 +53,3 @@
5353
5. **Deploy**
5454

5555
You can deploy this example on Gatsby Cloud by copying the example into a new repo and [connecting that to Gatsby Cloud](https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/deploying-to-gatsby-cloud/#set-up-an-existing-gatsby-site).
56-
57-
<!--- Working on improving deploy now to use subdirectories
58-
4. **Deploy**
59-
You can directly deploy this example by using the Deploy button below and select the directory for the Airtable example. Otherwise, fork this repo and create your own repo and [connect that to Gatsby Cloud](https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/deploying-to-gatsby-cloud/#set-up-an-existing-gatsby-site).
60-
61-
[<img src="https://www.gatsbyjs.com/deploynow.svg">](https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-functions-beta/)
62-
63-
64-
65-
[<img src="https://www.gatsbyjs.com/deploynow.svg">](https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-functions-beta/tree/main/examples/airtable-form)
66-
67-
-->

examples/functions-airtable-form/gatsby-config.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
require("dotenv").config()
2+
13
module.exports = {
2-
flags: {
3-
FUNCTIONS: true,
4-
},
54
siteMetadata: {
65
title: "Airtable Form",
76
},

examples/functions-airtable-form/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
},
1717
"dependencies": {
1818
"airtable": "^0.10.1",
19-
"gatsby": "^3.4.0",
20-
"gatsby-plugin-gatsby-cloud": "^2.3.0",
19+
"gatsby": "next",
20+
"gatsby-plugin-gatsby-cloud": "next",
2121
"react": "^17.0.1",
2222
"react-dom": "^17.0.1"
2323
}

examples/functions-auth0/LICENSE

Lines changed: 0 additions & 14 deletions
This file was deleted.

examples/functions-auth0/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ To test this Example locally you'll need to:
1212

1313
1. Create an application in [Auth0](https://auth0.com/) of type "Single Page Application" and configure `http://localhost:8000` as the Allowed Callback URL, Allowed Logout URL, Allowed Web Origins and Allowed CORS.
1414
2. Create an API in Auth0 (e.g. with the name of `tv-shows` and identifier of `https://api/tv-shows`) and create a permission for that API (e.g. `read:shows`)
15-
3. Rename the `.env-template` file to `.env.development` and update all of the settings there with the domain and clientId from the appplication you made in Auth0.
15+
3. Rename the `.env-template` file to `.env.development` and update all of the settings there with the domain and clientId from the application you made in Auth0.
1616
4. Run `yarn run start` which will run the Gatsby application and the Gatsby functions.
1717

1818
## How does example this work?
@@ -27,7 +27,7 @@ The `access_token` is then provided to our Functions to authenticate the request
2727

2828
In the Gatsby Functions we use [@serverless-jwt/jwt-verifier](https://github.com/sandrinodimattia/serverless-jwt/tree/master/packages/jwt-verifier) to secure our functions.
2929

30-
The `JwtVerifier` serves as a way to verify your token. If the token is not valid, the we return an error to the client. If it is valid, it will expose all of the claims to the current function and you'll have the guarantee that the request is authenticated.
30+
The `JwtVerifier` serves as a way to verify your token. If the token is not valid, then we return an error to the client. If it is valid, it will expose all of the claims to the current function and you'll have the guarantee that the request is authenticated.
3131

3232
```js
3333
const {

examples/functions-auth0/gatsby-browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react"
1+
import * as React from "react"
22
import { navigate } from "gatsby"
33
import { Auth0Provider } from "@auth0/auth0-react"
44

examples/functions-auth0/gatsby-config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ require("dotenv").config({
66
})
77

88
module.exports = {
9-
flags: {
10-
FUNCTIONS: true,
11-
},
129
plugins: [
1310
{
1411
resolve: "gatsby-plugin-create-client-paths",

examples/functions-auth0/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
"@auth0/auth0-react": "^1.0.0",
1313
"@serverless-jwt/jwt-verifier": "^0.2.1",
1414
"dotenv": "^8.2.0",
15-
"gatsby": "^3.4.0-next.6",
16-
"gatsby-plugin-gatsby-cloud": "^2.3.0",
15+
"gatsby": "next",
16+
"gatsby-plugin-gatsby-cloud": "next",
1717
"node-fetch": "^2.6.1",
1818
"react": "^17.0.2",
1919
"react-dom": "^17.0.2"
2020
},
2121
"devDependencies": {
22-
"gatsby-plugin-create-client-paths": "^3.3.0",
23-
"gatsby-plugin-postcss": "^4.3.0",
22+
"gatsby-plugin-create-client-paths": "next",
23+
"gatsby-plugin-postcss": "next",
2424
"prettier": "^2.2.1",
2525
"tailwindcss": "^1.5.2"
2626
}

0 commit comments

Comments
 (0)