Closed Mravuri96 closed 1 year ago
Should be fixed via https://github.com/invertase/dart_edge/commit/c75720b1f2af10021b869c561d5b17f82049aba0 on 0.0.2+3
. Let me know if there's any issues.
@Ehesp Could you re-open this. Just tried testing bit more and it seems to be only working in wrangler dev --local
mode. Publishing it or removing the --local
flag during development also seems to break it.
That's odd, the difference there is its running in miniflare vs workers. Not sure what the difference is there... Any errors?
Console output
A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished.
✘ [ERROR] Uncaught (in response) Error: The script will never generate a response.
Oh, yeah @Mravuri96 this won't work. When there's no --dev
flag the code is actually running on Cloudflare's services, so it's not going to be able to find localhost.
Custom headers are not being passed through the exposed fetch function.
https://github.com/invertase/dart_edge/blob/052fc4f94ccd1b7f16ed800cc8aeac96789cb9ff/packages/cloudflare_workers/lib/public/top.dart#L38
Code sample
```dart import 'dart:convert'; import 'package:cloudflare_workers/cloudflare_workers.dart'; import 'package:intl/intl.dart'; void main() async { final kiwiRepository = KiwiRepository(); CloudflareWorkers( fetch: (final Request request, final _, final __) async { if (request.url.toString().contains('favicon.ico')) { return Response(null); } try { final tickets = await kiwiRepository.fetchTickets(); return Response(jsonEncode(tickets)); } catch (e) { return Response('Error: $e'); } }, ); } class KiwiRepository { const KiwiRepository(); FutureOr