Heroku Node Stormpath

时间:2014-06-30 16:54:22

标签: node.js heroku stormpath

更新

我将此上传到Azure并立即生效 - 我认为该问题与.env文件有关,但我无法确定。

所以我按照指南here

我正在尝试将应用推向Heroku。我的所有配置变量都是正确的 - 但是,当我在heroku上启动应用程序时,我会收到:

/app/node_modules/stormpath/lib/ds/RequestExecutor.js:59
 npm ERR! VisualVMail@0.0.1 start: `node ./bin/www`
 npm ERR! Exit status 8
 npm ERR!
 npm ERR! Failed at the VisualVMail@0.0.1 start script.
 npm ERR! This is most likely a problem with the VisualVMail package,
 npm ERR! not with npm itself.
 npm ERR! Tell the author that this fails on your system:
 npm ERR!     node ./bin/www
 npm ERR! You can get their info via:
 npm ERR!     npm owner ls VisualVMail
 npm ERR! There is likely additional logging output above.
 npm ERR! System Linux 3.8.11-ec2
 npm ERR! command "/app/vendor/node/bin/node" "/app/vendor/node/bin/npm" "st

 npm ERR! cwd /app
 npm ERR! node -v v0.10.29
 npm ERR! npm -v 1.4.14
 npm ERR! code ELIFECYCLE
 npm ERR!
 npm ERR! Additional logging details can be found in:
 npm ERR!     /app/npm-debug.log
 npm ERR! not ok code 0

     throw new Error('request.uri field is required.');

是否有人能够运行Stormpath / nodejs / heroku,尤其是使用此示例应用程序?

3 个答案:

答案 0 :(得分:0)

看起来您的VisualVMail包有问题 - 您可以尝试调试吗?它在错误中说request.uri是必需的。

答案 1 :(得分:0)

错误" request.uri字段是必需的"来自stormpath图书馆。看看堆栈跟踪会有所帮助,你能在/app/npm-debug.log中查找它吗?它也可能在你的heroku日志中。

答案 2 :(得分:0)

如果最近你使用了Stormpath自动插件 - 这是Heroku设置与Stormpath集成的方式的问题(反之亦然)。我已经向他们发送了一份错误报告。

在你的Heroku public class ProductAdapter extends ArrayAdapter<Product> { private Activity activity; private ArrayList<Product> products; ArrayList<Product> cartItems; Product product; Menu menu; static Integer size; static Integer cartSize; private static LayoutInflater inflater = null; static View vi; String money = "$"; String dept = "Dept: "; String qty ="Qty: "; static String URI; public ProductAdapter(Activity activity, int textViewResourceId, ArrayList<Product> product) { super(activity, textViewResourceId, product); try { this.activity = activity; this.products = product; setCartItems(products); new getCartCount().execute(); inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); //imageLoader = new ImageLoader(activity.getApplicationActivity()); } catch (Exception e) { return; } } @Override public int getCount() { return products.size(); } public Product getItem(Product position) { return position; } @Override public long getItemId(int position) { return position; } public static class ViewHolder { public TextView product_name; public TextView product_desc; public TextView product_dept; public TextView product_price; public TextView product_qty; public ImageView product_img; } public View getView(int position, View convertView, ViewGroup parent) { vi = convertView; final ViewHolder holder; if(cartItems.size() == getCount()) { try { if (convertView == null) { vi = inflater.inflate(R.layout.activity_cart_items, parent, false); holder = new ViewHolder(); holder.product_name = (TextView) vi.findViewById(R.id.product_name); holder.product_dept = (TextView) vi.findViewById(R.id.product_dept); holder.product_desc = (TextView) vi.findViewById(R.id.product_desc); holder.product_price = (TextView) vi.findViewById(R.id.product_price); holder.product_qty = (TextView) vi.findViewById(R.id.product_qty); holder.product_img = (ImageView) vi.findViewById(R.id.icon); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } Button remove = (Button) vi.findViewById(R.id.remove_btn); URI = "http://www.michaelscray.com/Softwear/graphics/"; URI += products.get(position).getProduct_img(); Uri uri = Uri.parse(URI + products.get(position).getProduct_img()); holder.product_name.setText(products.get(position).getProduct_name()); holder.product_desc.setText(products.get(position).getProduct_desc()); holder.product_dept.setText(dept + products.get(position).getProduct_dept()); holder.product_price.setText(money + String.valueOf(products.get(position).getPrice())); holder.product_qty.setText(qty + String.valueOf(products.get(position).getProduct_qty())); Picasso.with(getContext()).load(URI).error(R.mipmap.ic_launcher).into(holder.product_img); setProduct(getItem(position)); remove.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //do something new removeCartItem().execute(); //or some other task notifyDataSetChanged(); } }); } catch (Exception e) { e.printStackTrace(); } } return vi; } public class removeCartItem extends AsyncTask<Void, Void, Void> { String tempUser = MainActivity.currentAccount.getUsername(); Product updateCart = getProduct(); ArrayList<Product> cartItems = getCartItems(); ArrayList<Product> cartUpdate = Cart.getCartList(); Integer cartNumber = Cart.getCartNumber(); Integer tempSKU = updateCart.getSKU(); String queryResult = ""; protected void onPreExecute() { } protected Void doInBackground(Void... arg0) { if(tempUser != null && !(tempUser.equals("Guest"))) { try { Connection conn = ConnectDB.getConnection(); String queryString = "DELETE FROM `Orders` WHERE `User_Name` = '"+tempUser+"' AND `SKU` = '"+tempSKU+"'"; /* Insert User_Name, SKU, Price, and Shipped */ PreparedStatement st = conn.prepareStatement(queryString); st.executeUpdate(); conn.close(); } catch (Exception e) { e.printStackTrace(); queryResult = "Database connection failure!\n" + e.toString(); } cartItems.remove(updateCart); cartUpdate.remove(updateCart); setCartSize(cartNumber-1); } return null; } protected void onPostExecute(Void result) { Toast.makeText(getContext(), "Removed item: " + tempSKU + " from your cart!", Toast.LENGTH_SHORT).show(); } } public class getCartCount extends AsyncTask<Void, Void, Void> { String tempUser = MainActivity.currentAccount.getUsername(); int cartNum = 0; @Override protected void onPreExecute() { } @Override protected Void doInBackground(Void... arg0) { if(tempUser != null) { try { Connection conn = ConnectDB.getConnection(); String queryString = "SELECT * FROM Orders WHERE `User_Name` = '" + tempUser + "'"; PreparedStatement st = conn.prepareStatement(queryString); //st.setString(1, tempUser); final ResultSet result = st.executeQuery(queryString); while (result.next()) { cartNum++; } } catch (Exception e) { e.printStackTrace(); } } setCartSize(cartNum); return null; } protected void onPostExecute(Void result) { } } private void setProduct(Product product) { this.product = product; } private Product getProduct() { return product; } private void setCartItems(ArrayList<Product> cartItems) { this.cartItems = cartItems; } private ArrayList<Product> getCartItems() { return cartItems; } private void setCartSize(Integer size) { this.size = size; } public static Integer getCartSize() { return size; } } ;如果您有一个名为Settings > Config Variables的变量,请将其删除并添加一个名为STORMPATH_URL的新变量,其值为您的应用程序的href,例如STORMPATH_APPLICATION_HREF

然后它应该工作。

或者就您的环境文件而言,https://api.stormpath.com/v1/applications/<appIDhere>应为STORMPATH_APP_HREF