Skip to content

"xmLHttpRequest is not defined" #187

Open
@ialameh

Description

@ialameh

I tried to generate a node from the following code and I am getting an error

"xmLHttpRequest is not defined"

whenever the code is run (as a google cloud function)

this is my code

import 'package:firebase_functions_interop/firebase_functions_interop.dart';
import 'package:rest_client/rest_client.dart' as rc;

void main() {
  functions['sendInvites'] = functions
      .region('us-central1')
      .firestore
      .document('/invitations/{id}')
      .onCreate(createHook);
}

Future<void> createHook(DocumentSnapshot snapshot, EventContext context) async {
  final name = snapshot.data.getString('name');
  final data = DocumentData.fromMap({'name': name});
  await snapshot.firestore.collection('/bar').add(data);
  //    //    print('posting $jsonToPost');
   var client = rc.Client();
   var request = rc.Request(
             url: 'http://myurl:1337/parse/classes/profile',
       headers: {
         "X-Parse-Application-Id": "mysuperawesomekey",
         "X-Parse-Master-Key": "theyshouldchangemastertosomethngelse"
       },
       body: '{"name" : "$name"}',
       method: rc.RequestMethod.post);
   try {
     await client.execute(request: request);
   } catch (e) {
     print(e);
   }

}

do you have any idea how i can get this to work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions