CodeGenieApp / serverless-express

Run Express and other Node.js frameworks on AWS Serverless technologies such as Lambda, API Gateway, Lambda@Edge, and more.
https://codegenie.codes
Apache License 2.0
5.13k stars 668 forks source link

No exported member 'getCurrentInvoke'. #359

Closed michaelmerrill closed 3 years ago

michaelmerrill commented 3 years ago

import { configure, getCurrentInvoke } from '@vendia/serverless-express';

When trying to access getCurrentInvoke I'm getting the following error.

Module '"../node_modules/@vendia/serverless-express/src"' has no exported member 'getCurrentInvoke'.

// index.js

const configure = require('./configure')
const { getCurrentInvoke } = require('./current-invoke')

module.exports = configure
module.exports.getCurrentInvoke = getCurrentInvoke
michaelmerrill commented 3 years ago

I was importing incorrectly. should be import serverlessExpress, { getCurrentInvoke, } from '@vendia/serverless-express';

brettstack commented 3 years ago

Out of curiosity, how were you importing when you got the error?

michaelmerrill commented 3 years ago

I was importing like this:

import { configure, getCurrentInvoke } from '@vendia/serverless-express';

But I should have known better looking at the source.

module.exports = configure                                                      // only available as default
module.exports.getCurrentInvoke = getCurrentInvoke.         // only available as destructured property
abecks commented 3 years ago

I am seeing this error on 4.3.1, when using imports with TypeScript:

import serverlessExpress, { getCurrentInvoke } from '@vendia/serverless-express'

TS2305: Module '"../node_modules/@vendia/serverless-express/src"' has no exported member 'getCurrentInvoke'.

brettstack commented 3 years ago

@abecks could you send a PR to fix that?