File tree 1 file changed +12
-6
lines changed
src/functions-templates/js/fauna-graphql
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -14,19 +14,25 @@ function createFaunaGraphQL() {
14
14
. readFileSync ( path . join ( __dirname , "schema.graphql" ) )
15
15
. toString ( ) ; // name of your schema file
16
16
17
+ // encoded authorization header similar to https://www.npmjs.com/package/request#http-authentication
18
+ const Authorization = Buffer . from (
19
+ process . env . FAUNADB_SERVER_SECRET + ":"
20
+ ) . toString ( "base64" ) ;
21
+
17
22
var options = {
18
23
method : "POST" ,
19
24
body : dataString ,
20
- auth : {
21
- user : process . env . FAUNADB_SERVER_SECRET ,
22
- pass : ""
23
- }
25
+ headers : { Authorization }
24
26
} ;
25
27
26
28
fetch ( "https://graphql.fauna.com/import" , options )
29
+ // // uncomment for debugging
30
+ . then ( res => res . text ( ) )
27
31
. then ( body => {
28
- // // uncomment for debugging
29
- // console.log("body", body);
32
+ console . log (
33
+ "Netlify Functions:Create - `fauna-graphql/sync-schema.js` success!"
34
+ ) ;
35
+ console . log ( body ) ;
30
36
} )
31
37
. catch ( err => console . error ( "something wrong happened: " , { err } ) ) ;
32
38
}
You can’t perform that action at this time.
0 commit comments