-
Notifications
You must be signed in to change notification settings - Fork 218
Description
Related issues
I searched but did not find any
[REQUIRED] Version info
node: v22.21.0 (via nvm)
firebase-functions: 6.6.0
firebase-tools: 14.25.0
firebase-admin: 13.6.0
[REQUIRED] Test case
// runtimeConfig.ts
export const allowedOrigins = params.defineList('ALLOWED_ORIGINS');
// used in a function file
import * as config from '../runtimeConfig';
// I know this isn't "supposed" to be here, but needed a call outside of the function signature to get access to the cors content. I also tried to resolve it first in onInit but that was also unsuccessful.
const allowedOrigins = config.allowedOrigins;
export const loginToPortal = functions.https.onRequest(
{ cors: allowedOrigins as unknown as string[], secrets: config.noteableSecrets },
async (request, response) => {...}
// .env.projectId
// I tried many variations of an array syntax here including just a string, comma separated, surround with single quotes, etc. Nothing worked
ALLOWED_ORIGINS=["https://mywebsite.com", "https://app.mywebsite.com"]
[REQUIRED] Steps to reproduce
Run:
firebase deploy --only functions
[REQUIRED] Expected behavior
A successful deploy (which does work when I return to functions v5 and admin v12)
[REQUIRED] Actual behavior
This did not produce a firebase-debug.log file.
➜ firebase deploy --only functions
=== Deploying to ''...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run build
build
npm run lint && tsc
lint
eslint
- functions: Finished running predeploy script.
i functions: preparing codebase default for deployment
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
! functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions@latest in your functions directory.
! functions: Please note that there will be breaking changes when you upgrade.
i functions: Loading and analyzing source code for codebase default to determine what to deploy
Serving at port 8910
{"severity":"WARNING","message":"params.ALLOWED_ORIGINS.value() invoked during function deployment, instead of during runtime."}
{"severity":"WARNING","message":"This is usually a mistake. In configs, use Params directly without calling .value()."}
{"severity":"WARNING","message":"example: { memory: memoryParam } not { memory: memoryParam.value() }"}
SyntaxError: "undefined" is not valid JSON
at JSON.parse ()
at ListParam.runtimeValue (C:\Users\me\RiderProjects\Portal\functions\node_modules\firebase-functions\lib\params\types.js:420:26)
at ListParam.value (C:\Users\me\RiderProjects\Portal\functions\node_modules\firebase-functions\lib\params\types.js:39:21)
at Object.onRequest (C:\Users\me\RiderProjects\Portal\functions\node_modules\firebase-functions\lib\v2\providers\https.js:72:75)
at Object. (C:\Users\me\RiderProjects\Portal\functions\lib\portal\function-name.js:14:41)
at Module._compile (node:internal/modules/cjs/loader:1706:14)
at Object..js (node:internal/modules/cjs/loader:1839:10)
at Module.load (node:internal/modules/cjs/loader:1441:32)
at Function._load (node:internal/modules/cjs/loader:1263:12)
at TracingChannel.traceSync (node:diagnostics_channel:328:14)
Error: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error
Were you able to successfully deploy your functions?
no