Platform Error in Pages Functions

I have a simple sveltekit app with a static build and it works fine but when i add some node js code /functions and then deploy it it throw following error

The package “buffer” wasn’t found on the file system but is built into node. Are you trying to bundle for node? You can use “platform: ‘node’” to do that, which will remove this error.

I have added platform node to env but still have issues