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

event.body for handler #12

Open
shak18 opened this issue Sep 7, 2022 · 2 comments
Open

event.body for handler #12

shak18 opened this issue Sep 7, 2022 · 2 comments

Comments

@shak18
Copy link

shak18 commented Sep 7, 2022

Is there any change from the base aws images that could affect this? as after creating my own image and attempt o use this everything goes well but i cannot send any parameters to the tests it always return a message event.body undefined if i inject the event paramenter to the handler

@vladholubiev
Copy link
Member

Most likely smth related to your code, as it still works fine for us, no changes made. Maybe if you paste some of your code somebody will be able to help.

@shak18
Copy link
Author

shak18 commented Sep 8, 2022

This is my handler code


const { convertFileToPDF } = require("./logic");

module.exports.handler = async (event, context, cb) => {
    if(! event || ! event.body) {
        console.log('[Empty request body]')
        return  cb(null, {
            headers: {
                "Access-Control-Allow-Origin": "*"
            },
            body: JSON.stringify({ message: 'Invalid body provided' })
        });
    }
    console.log(event)
    const { filename, base64File } = JSON.parse(event.body);
    const pdfFileURL = await convertFileToPDF(base64File, filename).catch(cb);
    return cb(null, {
        headers: {
            "Access-Control-Allow-Origin": "*"
        },
        body: JSON.stringify({ pdfFileURL })
    });
};

it just goes directly into the empty event.body condition and im inserting data through the lambda test interface

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

No branches or pull requests

2 participants