Skip to content

Commit b7ef2e5

Browse files
authored
Update functions.md
1 parent 7193918 commit b7ef2e5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

docs/functions/functions.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ export class AppModule {}
9696

9797
### Cloud Functions emulator
9898

99-
Point callable Functions to the Cloud Function emulator by adding `ORIGIN` to the `providers` section of your `NgModule`.
99+
Point callable Functions to the Cloud Function emulator by adding `USE_EMULATOR` to the `providers` section of your `NgModule`.
100100

101101
```ts
102102
import { NgModule } from '@angular/core';
103-
import { AngularFireFunctionsModule, ORIGIN } from '@angular/fire/functions';
103+
import { AngularFireFunctionsModule, USE_EMULATOR } from '@angular/fire/functions';
104104

105105
@NgModule({
106106
imports: [
@@ -110,7 +110,7 @@ import { AngularFireFunctionsModule, ORIGIN } from '@angular/fire/functions';
110110
],
111111
...
112112
providers: [
113-
{ provide: ORIGIN, useValue: 'http://localhost:5001' }
113+
{ provide: USE_EMULATOR, useValue: ['localhost', 5001] }
114114
]
115115
})
116116
export class AppModule {}
@@ -127,11 +127,11 @@ To set this up, you first need to update your `hosting` section in `firebase.jso
127127
"hosting": {
128128
"rewrites": [
129129
{
130-
"source": "/project-name/us-central1/someFunction",
130+
"source": "/someFunction",
131131
"function": "someFunction"
132132
},
133133
{
134-
"source": "/project-name/us-central1/anotherFunction",
134+
"source": "/anotherFunction",
135135
"function": "anotherFunction"
136136
},
137137
...
@@ -145,7 +145,7 @@ Next, configure functions origin to point at your app domain:
145145

146146
```ts
147147
import { NgModule } from '@angular/core';
148-
import { AngularFireFunctionsModule, ORIGIN } from '@angular/fire/functions';
148+
import { AngularFireFunctionsModule, ORIGIN, NEW_ORIGIN_BEHAVIOR } from '@angular/fire/functions';
149149

150150
@NgModule({
151151
imports: [
@@ -155,6 +155,7 @@ import { AngularFireFunctionsModule, ORIGIN } from '@angular/fire/functions';
155155
],
156156
...
157157
providers: [
158+
{ provide: NEW_ORIGIN_BEHAVIOR, useValue: true },
158159
{ provide: ORIGIN, useValue: 'https://project-name.web.app' }
159160
]
160161
})

0 commit comments

Comments
 (0)