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

BadBody: INTERNAL ERROR when input to Backend.Custom.run is mutated #465

Open
pyrex41 opened this issue Apr 4, 2024 · 1 comment
Open

Comments

@pyrex41
Copy link

pyrex41 commented Apr 4, 2024

when a Backend.Custom function mutates its input, this causes an error from elm-pages: BadBody: INTERNAL ERROR

export async function myFunction(data) {
   for (let key in data) {
      if (data[key] === null) {
        delete data[key];
      }
    };
   ............

the workaround is straight-forward, but would be better I think to handle internally in elm-pages so not an issue to be worried about in custom-backend-tasks.ts

export async function myFunction(dataInit) {
  let data = JSON.parse(JSON.stringify(dataInit));
   for (let key in data) {
      if (data[key] === null) {
        delete data[key];
      }
    };
   ............
@miniBill
Copy link
Contributor

miniBill commented Apr 4, 2024

(I suspect this might be the cause for some hangs I've seen in the past)

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

No branches or pull requests

2 participants