Skip to content
Back

Dart Runtime error on local functions 'Request body size exceeds the size limit.'

  • 0
  • Functions
Vincent Berthoumieux
9 Oct, 2024, 10:20

Hello,

I'm trying the local functions dev env. It's very useful.

I tried python-3.9 and it works out of the box But I can't get dart runtimes working. I tried dart-3.1 and dart-3.3

I've updated the docker compose .env

TypeScript
_APP_FUNCTIONS_RUNTIMES=node-16.0,php-8.0,python-3.9,ruby-3.0,dart-3.3,dotnet-3.1,dart-3.1

and downloaded the runtimes docker pull openruntimes/dart:v3-3.1 (tried v4-3.1 as well) docker pull openruntimes/dart:v3-3.3

then restarted the containers

Function is very basic:

TypeScript
import 'dart:async';

// This Appwrite function will be executed every time your function is triggered
Future<dynamic> main(final context) async {
  return context.res.json({
    'motto': 'Build like a team of hundreds_',
    'learn': 'https://appwrite.io/docs',
    'connect': 'https://appwrite.io/discord',
    'getInspired': 'https://builtwith.appwrite.io',
  });
}

The functions are well created but when I request the http://localhost:3000/ I get the following error:

TypeScript

Request body size exceeds the size limit.
#0      action (file:///usr/local/server/src/server.dart:33)
#1      main.<anonymous closure> (file:///usr/local/server/src/server.dart:196)
#2      handleRequest (package:shelf/shelf_io.dart:138)
#3      serveRequests.<anonymous closure>.<anonymous closure> (package:shelf/shelf_io.dart:91)
#4      _rootRunUnary (dart:async/zone.dart:1407)
#5      _CustomZone.runUnary (dart:async/zone.dart:1308)
#6      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1217)
#7      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339)
#8      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271)
#9      _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:784)
#10     _StreamController._add (dart:async/stream_controller.dart:658)
.....

Am I missing something ?

TL;DR
Developers facing Dart Runtime error "Request body size exceeds the size limit" when trying to run local functions. They have updated the Dart runtimes in docker compose and restarted containers but still encountering the issue. Solution: Adjust the maximum request body size setting in the Dart server config to handle larger requests.
ZiaChoudhary
9 Oct, 2024, 10:24

Can you show example of the request body that is causing the issue

Vincent Berthoumieux
9 Oct, 2024, 10:25

I just went to http://localhost:3000/ with a browser, it works for the python runtime

Vincent Berthoumieux
9 Oct, 2024, 10:27

I guess it's an empty GET query

ZiaChoudhary
9 Oct, 2024, 10:29

So you are not able to access your dashboard? m I right?

If yes then

Try these

docker compose down docker compose up -d --remove-orphans

Vincent Berthoumieux
9 Oct, 2024, 10:30

I'm calling a local function (run with 'appwrite run function'). How is it related to the dashboard ?

Vincent Berthoumieux
9 Oct, 2024, 10:31

yes I'm able to access the dashboard

ZiaChoudhary
9 Oct, 2024, 10:32

Try to execute your function from dashboard.

Vincent Berthoumieux
9 Oct, 2024, 10:34

A local function does not exist in the dashboard. It exists only once you execute 'appwrite push functions'

ZiaChoudhary
9 Oct, 2024, 10:37

Let me reproduce it on my side.

Vincent Berthoumieux
9 Oct, 2024, 10:38

I used 'appwrite init functions' to create it

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more