Skip to main content

Request Handling

Last updated on April 15, 2025

Overview

Extend Apps leverage gRPC and gRPC-Gateway as core technologies to support robust, scalable, and customizable backend services within the AccelByte ecosystem. These technologies provide a high-performance framework for defining APIs, handling any client-server or any server-server communication, and exposing gRPC services as RESTful endpoints when needed.

Understanding how gRPC requests are processed in Extend Apps is essential for developers who want to override existing service logic or implement new functionality.

gRPC Request Handling

The following guides walk you through service definition, client/server setup, and request handling logic for languages supported by Extend:

gRPC Error Handling

Refer to these official resources for best practices:

To ensure proper error handling and to provide clients with meaningful feedback, it’s recommended to use specific gRPC status codes when appropriate and to include detailed error messages wherever possible.

danger

When implementing gRPC methods, it is important to handle errors appropriately. If an exception is thrown within a method implementation, it will result in a 13 INTERNAL gRPC status code (or 500 Internal Server Error in HTTP).

gRPC Error Handling with gRPC-Gateway

Extend Apps surfaces gRPC errors in a structured way, especially when paired with gRPC-Gateway. These errors are mapped to standard HTTP status codes to ensure compatibility with RESTful clients.

gRPC to HTTP Status Code Mapping
gRPC CodeHTTP Status Code
0 OK200 OK
1 CANCELLED499 -
2 UNKNOWN500 Internal Server Error
3 INVALID_ARGUMENT400 Bad Request
4 DEADLINE_EXCEEDED504 Gateway Timeout
5 NOT_FOUND404 Not Found
6 ALREADY_EXISTS409 Conflict
7 PERMISSION_DENIED403 Forbidden
8 RESOURCE_EXHAUSTED429 Too Many Requests
9 FAILED_PRECONDITION400 Bad Request
10 ABORTED409 Conflict
11 OUT_OF_RANGE400 Bad Request
12 UNIMPLEMENTED501 Not Implemented
13 INTERNAL500 Internal Server Error
14 UNAVAILABLE503 Service Unavailable
15 DATA_LOSS500 Internal Server Error
16 UNAUTHENTICATED401 Unauthorized

For full implementation details, refer to gRPC-Gateway errors.go.

danger

A 500 Internal Server Error can be retried multiple times by the client, depending on the client's retry logic configuration. It is important to account for this when designing services, as excessive retries could lead to performance bottlenecks or unintended side effects if not properly handled.