用firebase cloud function寫api
我用的是typescript
我部署從別的ts匯入的function
結果發生找不到的error
是我export寫錯嗎?
檔案結構:
functions
|-lib
|-node_modules
|-src
|-index.ts
|-common.ts
index.ts
import * as functions from 'firebase-functions';
const admin = require('firebase-admin');
const firebase = require('firebase');
admin.initializeApp();
const firebaseConfig = {
};
firebase.initializeApp(firebaseConfig);
import * as _common from './common';
module.exports = {
_common
};
common.ts
export const log = functions.https.onCall(async (data: any, context: any) => {
// process
});
cmd: firebase deploy --only functions:log
error: the following filters were specified but do not match any functions in the project: log
看起來他找不到你的 log
試試看改成這樣
module.exports = {
log: _common.log
};
或
module.exports = {
..._common
};
我猜的