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

Eleventy Serverless Function Error - Cannot find module '/var/task/functions/userlibs/eleventy-serverless-map.json' #2932

Closed
wingsooyoung opened this issue May 10, 2023 · 1 comment

Comments

@wingsooyoung
Copy link

Operating system

Windows 10 Version 22H2

Eleventy

2.0.0

Describe the bug

I wanted to try out Sanity.io and see if it'd be useful to integrate with a different site of mine, so I found this demo and the accompanying tutorial on the Eleventy docs website.

So, I made it through almost the entire tutorial successfully except I am stuck on the VERY LAST PART - my function is deployed, recognized, yet no matter what I do it results with "Invocation Failed":

Error: Cannot find module '/var/task/functions/userlibs/eleventy-serverless-map.json'
Require stack:
- /var/task/node_modules/@11ty/eleventy/src/Serverless.js
- /var/task/node_modules/@11ty/eleventy/src/Eleventy.js
- /var/task/index.js
- /var/task/userlibs.js
- /var/runtime/index.mjs
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1026:15)
    at Function.Module._load (node:internal/modules/cjs/loader:871:27)
    at Module.require (node:internal/modules/cjs/loader:1098:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at Serverless.getContentMap (/var/task/node_modules/@11ty/eleventy/src/Serverless.js:105:12)
    at Serverless.isServerlessUrl (/var/task/node_modules/@11ty/eleventy/src/Serverless.js:119:27)
    at handler (/var/task/index.js:36:14)

Now, in addition, this tutorial gave me a couple other issues along the way. One is that I was meant to include:

**/functions/userlibs/**
!/functions/userlibs/index.js

in my .gitignore, but it would come up with an error when I ran "npm run build":
Eleventy:EleventyFiles >>> When processing .gitignore/.eleventyignore, Eleventy does not currently support negative patterns but encountered one
So, thinking that may have been my issue, I created an .eleventyignore file and set eleventyConfig.setUseGitIgnore(false).
The other thing I can't fix is that, again while running "npm run build", I always see this:
[11ty] ENOENT: no such file or directory, open 'C:\Users\...\madlibs-sanitytest\site\functions\userlibs\functions\userlibs\functions\userlibs\functions\userlibs\functions\userlibs\_data\madlibs.js' (via Error)
The specific file path does change depending on what small tweaks and changes I try to make to fix this, but nothing I do seems to be able to get rid of this error.

So TLDR: serverless function keeps throwing Invocation Failed - Cannot find module '/var/task/functions/userlibs/eleventy-serverless-map.json', which may or may not be related to a ! negation in my .gitignore, and may or may not also be related to the ENOENT: no such file or directory error. I've done so much googling and adjusting and for the life of me I can't figure this out!!!

P.S. I took two intro to comp-sci courses in university that taught me NOTHING about coding for websites so 99% of my knowledge is self-taught. My point is I don't have a solid foundation for any of this and I'm just stumbling around blind and figuring shit out as I go... So any help at all or even just an explanation as to what I've done (wrong) is very much appreciated!!!

Reproduction steps

  1. Go to 'https://rollbacking--madlibs-sanitytest.netlify.app/madlibs/here-we-go/', fill out the madlib, hit done and receive a link to share your filled-out madlib (aka "userlib")
  2. Click on the link to your userlib. For example: 'Your url is /usermadlib/tFxJbjBBawIaRXmXCmJlX/'
  3. See the invocation error

Expected behavior

The demo website works perfectly fine, as you can see here: https://brob-madlibs.netlify.app/madlibs/call-me-ishmael/

Reproduction URL

https://github.com/wingsooyoung/madlibs-sanitytest

Screenshots

Invocation Error:
bug 1
ENOENT Error:
bug 2
Current package.json settings:
pjson as of may1023

@zachleat
Copy link
Member

zachleat commented Apr 9, 2024

Stale per project slipstream changes in #3074. Sorry!

@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