Meteor Autovalue函数和集合插入中的Web3 API调用错误
我正在运行一个Meteor应用程序,遇到了一个我无法理解的错误。我正在使用一个快速表单将文档插入到集合中,其中一个字段是使用auto value从web3 api调用获得的哈希地址Meteor Autovalue函数和集合插入中的Web3 API调用错误,api,meteor,meteor-methods,Api,Meteor,Meteor Methods,我正在运行一个Meteor应用程序,遇到了一个我无法理解的错误。我正在使用一个快速表单将文档插入到集合中,其中一个字段是使用auto value从web3 api调用获得的哈希地址 //Schema with autovalue to obtain hash address via web3 call CustomerSchema = new SimpleSchema({ customerBlockchainAddress: { type: String, label: "B
//Schema with autovalue to obtain hash address via web3 call
CustomerSchema = new SimpleSchema({
customerBlockchainAddress: {
type: String,
label: "Blockchain Address",
autoValue: function() {
var address = web3.personal.newAccount("password");
console.log("Address: ", address);
return address;
},
autoform: {
type: "hidden"
}
},
//additional schema fields
该方法由快速表单调用。见下文:
//HTML
<template name="NewCompany">
<div class="new-document-container">
{{#if isSuccessfulCompany }}
<h3 class="success">Successfully registered company information. <br /> <br /> </h3>
{{else}}
<h3>Register Company Information:</h3><br />
{{> quickForm collection="Companies" id="insertCompanyForm" type="method" meteormethod="insertCompany" class="new-Company-form"}}
{{/ if}}
</div>
我得到的错误是:
Exception while invoking method 'insertCustomer' TypeError:
XMLHttpRequest is not a function
AutoValue函数使用log语句从web3调用中按预期获取新地址,但在抛出错误之前,它使用不同的地址打印了四次。如果我只使用一个字符串硬编码地址,则insert函数可以像定制API预期的那样正常工作
当API调用正在工作并插入到一个集合中时,我回滚到我的应用程序的上一个版本,该版本使用的是带有过期软件包的过时版本Meteor。在调用“meteor update”时,调用停止工作,并显示相同的错误。有人能解释一下是什么导致了这个错误吗
更新:我正确地更新了aldeed:autoform并删除了aldeed:simple模式,并按照包的自述文件中的指示安装了NPM simpl模式。仍在抛出错误
谢谢您能提供调用
insertCustomer
方法的代码吗?@jordanwillis它是通过快速表单调用的。我用快速表单代码更新了问题。听起来问题是关于更新的。我在“AutoForm 6.0现在可用,需要将应用程序切换到使用NPM和aldeed:collection2 core提供的SimpleSchema包”上看到了这一点。既然您只运行了meteor update,那么您是否删除了SimpleSchema包并通过npm安装了它?可能是这导致了问题?@jordanwillis我删除了简单模式包,并按照指示安装了简单模式NPM,但错误仍然存在。还有其他想法吗?你能提供调用insertCustomer
方法的代码吗?@jordanwillis它是通过快速表单调用的。我用快速表单代码更新了问题。听起来问题是关于更新的。我在“AutoForm 6.0现在可用,需要将应用程序切换到使用NPM和aldeed:collection2 core提供的SimpleSchema包”上看到了这一点。既然您只运行了meteor update,那么您是否删除了SimpleSchema包并通过npm安装了它?可能是这导致了问题?@jordanwillis我删除了简单模式包,并按照指示安装了简单模式NPM,但错误仍然存在。还有其他想法吗?
Exception while invoking method 'insertCustomer' TypeError:
XMLHttpRequest is not a function