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

Serverless and Firebase Functions. #1866

Closed
robdodson opened this issue Jun 29, 2021 · 8 comments
Closed

Serverless and Firebase Functions. #1866

robdodson opened this issue Jun 29, 2021 · 8 comments

Comments

@robdodson
Copy link

Describe the bug
I'm trying to get eleventy serverless working with firebase functions. I think I've set everything up correctly, but when I visit my function I get a Node error saying that it can't find eleventy-serverless-map.json.

To Reproduce
Steps to reproduce the behavior:

I put together a gist to show my structure:
https://gist.github.com/robdodson/e223a02a02859d28d555229cd9a73245

Expected behavior
A clear and concise description of what you expected to happen.

When I visit /possum/ I shouldn't see an error.

Actual behavior
I get the following error

Cannot find module '/Users/…/functions/eleventy-serverless-map.json

Environment:

  • OS and Version: macOS
  • Eleventy Version: 1.0.0-canary.38
@zachleat
Copy link
Member

This is as far as I got and the error message I’d expect to see on localhost right now

https://stackblitz.com/edit/node-txhs9w?devtoolsheight=33&file=.eleventy.js

image

@zachleat
Copy link
Member

The localhost experience (right now) expects a handler function in the possum/index.js file. That’s the convention on the serverless hosts I’ve used, but I’m open to extending it!

@zachleat zachleat added the feature: 🏙 serverless Eleventy Serverless label Jun 29, 2021
@robdodson
Copy link
Author

oh it looks like the stackblitz project is gone (or maybe it's private?)

In my code I did have a handler function in functions/possum/index.js. Unfortunately github gists don't let me show subdirectories so I tried to add the directory paths as comments at the top of the files.

@zachleat
Copy link
Member

Ah sorry about that! I renamed it https://stackblitz.com/edit/robs-firebase-test

@robdodson
Copy link
Author

The localhost experience (right now) expects a handler function in the possum/index.js file.

Oh, so the function literally needs to be named exports.handler ?

@robdodson
Copy link
Author

oh snaaaaap! I got it working. I'll put together an example repo to share.

image

@robdodson
Copy link
Author

Here's a repo: https://github.com/robdodson/eleventy-serverless-firebase

I did find one issue though, the _data directory does not seem to work. It works when I do a static build, but not when I let the function render it. I can see that the _data directory is being copied over to the right place, so I'm not sure what's up.

image

@robdodson robdodson changed the title Serverless and Firebase Functions. Cannot find module '/…/functions/eleventy-serverless-map.json Serverless and Firebase Functions. Jul 1, 2021
@zachleat
Copy link
Member

zachleat commented Apr 9, 2024

Stale per project slipstream changes in #3074.

@zachleat zachleat closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants