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

Cannot find module '@netlify/functions' #340

Open
@lukasborawski

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.

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