Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Cannot find module '@netlify/functions' #340

Description

@lukasborawski

Hello. So I'm using scheduled functions and along with the dev env/mode it's working fine, I can serve it and invoke it. But as long I'm putting this to the server I have this error:

ERROR	Uncaught Exception 	{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module '@netlify/functions' ... 

The package is defined as a dependency in the package.json, and this is my function:

const { schedule } = require('@netlify/functions')

exports.handler = schedule('@hourly', async (event) => {
  const eventBody = JSON.parse(event.body)
  console.log(`Next function run at ${eventBody.next_run}.`)
  // function init
  return {
    statusCode: 200,
  }
})

Netlify config:

[build]
    functions = "functions"
     publish = "./"

[functions]
    directory = "functions/"
    external_node_modules = ["canvas", "jsdom"]

Functions are enabled on the Labs and Project page. What is wrong? Thanks for the help in advance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugcode to address defects in shipped code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions