Skip to content

nextjs with firebase cloud functions #72

@sarovin

Description

@sarovin

Hi,
i want use nextjs with firebase and run the server on cloud functions.

i have this index.js in functions dir:

import * as functions from 'firebase-functions';
import cors from 'cors';
import express from 'express';
import next from 'next';

const nextApp = next({ dev: false });
const handle = nextApp.getRequestHandler();

nextApp
  .prepare()
  .then(() => {
    const server = express();
    server.use(cors({ origin: true }));

    server.get('/a', (req, res) => {
      return nextApp.render(req, res, '/b', req.query);
    });

    server.get('/b', (req, res) => {
      return nextApp.render(req, res, '/a', req.query);
    });

    server.get('*', (req, res) => {
      return handle(req, res);
    });
  })
  .catch(ex => {
    console.error(ex.stack);
    process.exit(1);
  });

export let app = functions.https.onRequest(nextApp);

The problem is that i can't upload on the cloud the nextjs build folder.
How i can include this folder?

vercel/next.js#2017

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions