简体   繁体   中英

Node module doesn't work in Firebase hosting?

I have a Node server and use Firebase hosting. The server uses the Node module rss-to-json for parsing a RSS feed to JSON.

When I test the server on my machine, the request works, but when deploying it doesn't work. It just loads forever and gives:

"Error 503 first byte timeout"

My code:

const functions = require("firebase-functions");
const express = require("express");
const Feed = require("rss-to-json");

app.get("/feed", (req, res) => {
    Feed.load("https://www.reddit.com/.rss", function(err, rss) {
        res.send(rss);
    });
});

exports.app = functions.https.onRequest(app);

Have tried:

Removed "node_modules" from "ignore" in firebase.json, but no luck.

Any ideas?

On the Spark payment plan, you can't make outgoing requests to services that aren't fully controlled by Google. If you want to do this, you'll have to upgrade your project to the Blaze plan. See the pricing page for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM