• "providers/https"

Index

Type aliases

CanonicalErrorCodeName

CanonicalErrorCodeName: "OK" | "CANCELLED" | "UNKNOWN" | "INVALID_ARGUMENT" | "DEADLINE_EXCEEDED" | "NOT_FOUND" | "ALREADY_EXISTS" | "PERMISSION_DENIED" | "UNAUTHENTICATED" | "RESOURCE_EXHAUSTED" | "FAILED_PRECONDITION" | "ABORTED" | "OUT_OF_RANGE" | "UNIMPLEMENTED" | "INTERNAL" | "UNAVAILABLE" | "DATA_LOSS"

FunctionsErrorCode

FunctionsErrorCode: "ok" | "cancelled" | "unknown" | "invalid-argument" | "deadline-exceeded" | "not-found" | "already-exists" | "permission-denied" | "resource-exhausted" | "failed-precondition" | "aborted" | "out-of-range" | "unimplemented" | "internal" | "unavailable" | "data-loss" | "unauthenticated"

The set of Firebase Functions status codes. The codes are the same at the ones exposed by gRPC here: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md

Possible values:

  • 'cancelled': The operation was cancelled (typically by the caller).
  • 'unknown': Unknown error or an error from a different error domain.
  • 'invalid-argument': Client specified an invalid argument. Note that this differs from 'failed-precondition'. 'invalid-argument' indicates arguments that are problematic regardless of the state of the system (e.g. an invalid field name).
  • 'deadline-exceeded': Deadline expired before operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire.
  • 'not-found': Some requested document was not found.
  • 'already-exists': Some document that we attempted to create already exists.
  • 'permission-denied': The caller does not have permission to execute the specified operation.
  • 'resource-exhausted': Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
  • 'failed-precondition': Operation was rejected because the system is not in a state required for the operation's execution.
  • 'aborted': The operation was aborted, typically due to a concurrency issue like transaction aborts, etc.
  • 'out-of-range': Operation was attempted past the valid range.
  • 'unimplemented': Operation is not implemented or not supported/enabled.
  • 'internal': Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken.
  • 'unavailable': The service is currently unavailable. This is most likely a transient condition and may be corrected by retrying with a backoff.
  • 'data-loss': Unrecoverable data loss or corruption.
  • 'unauthenticated': The request does not have valid authentication credentials for the operation.

Variables

Const LONG_TYPE

LONG_TYPE: "type.googleapis.com/google.protobuf.Int64Value" = "type.googleapis.com/google.protobuf.Int64Value"

Const UNSIGNED_LONG_TYPE

UNSIGNED_LONG_TYPE: "type.googleapis.com/google.protobuf.UInt64Value" = "type.googleapis.com/google.protobuf.UInt64Value"

Const corsHandler

corsHandler: RequestHandler = cors({ origin: true, methods: 'POST' })

Functions

isValidRequest

  • isValidRequest(req: Request): boolean
  • Parameters

    Returns boolean

onCall

  • Declares a callable method for clients to call using a Firebase SDK.

    Parameters

    • handler: function

      A method that takes a data and context and returns a value.

    Returns HttpsFunction & Runnable<any>

onRequest

  • Handle HTTP requests.

    Parameters

    • handler: function

      A function that takes a request and response object, same signature as an Express app.

        • (req: Request, resp: express.Response): void
        • Parameters

          • req: Request
          • resp: express.Response

          Returns void

    Returns HttpsFunction

Object literals

Const errorCodeMap

errorCodeMap: object

Standard error codes and HTTP statuses for different ways a request can fail, as defined by: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto

This map is used primarily to convert from a client error code string to to the HTTP format error code string and status, and make sure it's in the supported set.

aborted

aborted: object

canonicalName

canonicalName: "ABORTED" = "ABORTED"

status

status: number = 409

already-exists

already-exists: object

canonicalName

canonicalName: "ALREADY_EXISTS" = "ALREADY_EXISTS"

status

status: number = 409

cancelled

cancelled: object

canonicalName

canonicalName: "CANCELLED" = "CANCELLED"

status

status: number = 499

data-loss

data-loss: object

canonicalName

canonicalName: "DATA_LOSS" = "DATA_LOSS"

status

status: number = 500

deadline-exceeded

deadline-exceeded: object

canonicalName

canonicalName: "DEADLINE_EXCEEDED" = "DEADLINE_EXCEEDED"

status

status: number = 504

failed-precondition

failed-precondition: object

canonicalName

canonicalName: "FAILED_PRECONDITION" = "FAILED_PRECONDITION"

status

status: number = 400

internal

internal: object

canonicalName

canonicalName: "INTERNAL" = "INTERNAL"

status

status: number = 500

invalid-argument

invalid-argument: object

canonicalName

canonicalName: "INVALID_ARGUMENT" = "INVALID_ARGUMENT"

status

status: number = 400

not-found

not-found: object

canonicalName

canonicalName: "NOT_FOUND" = "NOT_FOUND"

status

status: number = 404

ok

ok: object

canonicalName

canonicalName: "OK" = "OK"

status

status: number = 200

out-of-range

out-of-range: object

canonicalName

canonicalName: "OUT_OF_RANGE" = "OUT_OF_RANGE"

status

status: number = 400

permission-denied

permission-denied: object

canonicalName

canonicalName: "PERMISSION_DENIED" = "PERMISSION_DENIED"

status

status: number = 403

resource-exhausted

resource-exhausted: object

canonicalName

canonicalName: "RESOURCE_EXHAUSTED" = "RESOURCE_EXHAUSTED"

status

status: number = 429

unauthenticated