Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: functions.source missing error even though it's not missing #206

Open
Pieter0313 opened this issue Feb 3, 2023 · 2 comments
Open
Labels
bug Something isn't working

Comments

@Pieter0313
Copy link

Pieter0313 commented Feb 3, 2023

Describe the Bug

When running npm run build I get the following error:

error during build:
Error: Error: Required "functions.source" field is missing from Firebase Configuration file.
    at parseFirebaseConfiguration (file:///Users/pieterseegers/Documents/Websites/Avatary/avatary/node_modules/svelte-adapter-firebase/src/utils.js:164:9)
    at adapt (file:///Users/pieterseegers/Documents/Websites/Avatary/avatary/node_modules/svelte-adapter-firebase/src/index.js:26:35)
    at adapt (file:///Users/pieterseegers/Documents/Websites/Avatary/avatary/node_modules/@sveltejs/kit/src/core/adapt/index.js:28:8)
    at Object.handler (file:///Users/pieterseegers/Documents/Websites/Avatary/avatary/node_modules/@sveltejs/kit/src/exports/vite/index.js:611:12)
    at async PluginDriver.hookParallel (file:///Users/pieterseegers/Documents/Websites/Avatary/avatary/node_modules/rollup/dist/es/shared/rollup.js:23582:17)
    at async Object.close (file:///Users/pieterseegers/Documents/Websites/Avatary/avatary/node_modules/rollup/dist/es/shared/rollup.js:24937:13)
    at async Promise.all (index 0)
    at async build (file:///Users/pieterseegers/Documents/Websites/Avatary/avatary/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:44352:13)
    at async CAC.<anonymous> (file:///Users/pieterseegers/Documents/Websites/Avatary/avatary/node_modules/vite/dist/node/cli.js:808:9)

It says that the functions.source field is missing from my firebase configuration file, but it's definitely there;

{
	"firestore": {
		"rules": "firestore.rules",
		"indexes": "firestore.indexes.json"
	},
	"hosting": {
		"predeploy": "npm run build",
		"public": "build",
		"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
		"rewrites": [
			{
				"source": "**",
				"function": "ssr",
				"region": "europe-west1"
			}
		]
	},
	"functions": [
		{
			"codebase": "default",
			"ignore": ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log"],
			"source": "build"
		}
	],
	"storage": {
		"rules": "storage.rules"
	},
	"emulators": {
		"functions": {
			"port": 5001
		},
		"firestore": {
			"port": 8000
		},
		"hosting": {
			"port": 5005
		},
		"storage": {
			"port": 9199
		},
		"ui": {
			"enabled": true
		},
		"singleProjectMode": true
	}
}

Steps to Reproduce

  1. Added the adapter to svelte.config.js;
	kit: {
		adapter: adapter({
		})
	},
  1. Added a functions.source field
  2. Got the error

Expected Behaviour

I think it should recognize this field, but I'm not 100% sure if I'm doing something wrong.

svelte-adapter-firebase version

0.14.4

sveltejs/kit version

1.0.1

@Pieter0313 Pieter0313 added the bug Something isn't working label Feb 3, 2023
@DavidBradbury
Copy link

Just to help with this, it looks like after init, the functions property is now an array of objects rather than an object. Removing the array and making it just the object worked for me.

@gijswobben
Copy link

gijswobben commented May 16, 2023

True, but it should really be an array. I'm deploying functions from multiple sources..

It's also supported by Firebase to have an array.

Related to #196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants