Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"xmLHttpRequest is not defined" #187

Open
ialameh opened this issue Sep 4, 2020 · 0 comments
Open

"xmLHttpRequest is not defined" #187

ialameh opened this issue Sep 4, 2020 · 0 comments

Comments

@ialameh
Copy link

ialameh commented Sep 4, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant