FilledStacks / FilledStacks/firebase-backend
Using firebase-backend with a hosting site
- Dominant language
- TypeScript
- Stars
- 61
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to use a hosting site for my firebase backend (https://firebase.google.com/docs/hosting/full-config#rewrite-functions). Not sure if this is related to #36, but I think it's not.
Say, I have a function at `functions/src/string/uppercase.endoint.ts`.
I can call this function at https://us-central1-myproject.cloudfunctions.net/string-api/uppercase.
Now in my **firebase.json** I am configuring a site in the hope to get the same result with this URL: https://myproject-api.web.app/string-api/uppercase.
```
"hosting": [
{
"target": "api",
"rewrites": [
{
"source": "/string-api/**",
"function": "string-api"
}
]
}
],
```
The response leaves me confused. The function (`string-api`) is actually called, and it returns a 404:
`Cannot POST /string-api/uppercase`
But the path does look correct. The same request (`POST /string-api/uppercase`) does work on the ...cloudfunctions.net domain.
Believe me, I have tried different variations of the `source` and `function` setting. I'm actually struggling with this issue for more than two weeks. I am in contact with Firebase support but they also can't really say, because I'm using this unsupported library.
I couldn't decide whether to post it as a bug or as a feature request for an example of how to get firebase-backend to work with a hosting site. I hope of course that it is not a bug and I am just misconfiguring it.
Either way, I am really hoping for some help here. Thanks in advance.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.