Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions spec/function-builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,16 @@ describe('FunctionBuilder', () => {
});
}).to.throw();
});

it('should allow setting 4GB memory option', () => {
const fn = functions
.runWith({
memory: '4GB',
})
.region('europe-west1')
.auth.user()
.onCreate((user) => user);

expect(fn.__trigger.availableMemoryMb).to.deep.equal(4096);
});
});
1 change: 1 addition & 0 deletions src/cloud-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ export function optionsToTrigger(options: DeploymentOptions) {
'512MB': 512,
'1GB': 1024,
'2GB': 2048,
'4GB': 4096,
};
trigger.availableMemoryMb = _.get(memoryLookup, options.memory);
}
Expand Down
4 changes: 2 additions & 2 deletions src/function-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export function region(
* Configure runtime options for the function.
* @param runtimeOptions Object with optional fields:
* 1. `memory`: amount of memory to allocate to the function, possible values
* are: '128MB', '256MB', '512MB', '1GB', and '2GB'.
* are: '128MB', '256MB', '512MB', '1GB', '2GB', and '4GB'.
* 2. `timeoutSeconds`: timeout for the function in seconds, possible values are
* 0 to 540.
* 3. `failurePolicy`: failure policy of the function, with boolean `true` being
Expand Down Expand Up @@ -188,7 +188,7 @@ export class FunctionBuilder {
* Configure runtime options for the function.
* @param runtimeOptions Object with optional fields:
* 1. `memory`: amount of memory to allocate to the function, possible values
* are: '128MB', '256MB', '512MB', '1GB', and '2GB'.
* are: '128MB', '256MB', '512MB', '1GB', '2GB', and '4GB'.
* 2. `timeoutSeconds`: timeout for the function in seconds, possible values are
* 0 to 540.
* 3. `failurePolicy`: failure policy of the function, with boolean `true` being
Expand Down