const lamports = 0.001 * 10 ** 9;
  const fromPubKey = new PublicKey(
    'Wallet sending here'
  const toPubKey = new PublicKey(
    'Wallet receiving here'

  const transaction = new Transaction().add(
      fromPubkey: publicKey,
      toPubkey: toPubKey,

  const {
    context: { slot: minContextSlot },
    value: { blockhash, lastValidBlockHeight },
  } = await connection.getLatestBlockhashAndContext();

  try {
    const signature = await sendTransaction(transaction, connection, {

    loadingToast.current = toast.loading('Transaction loading...');
    await connection.confirmTransaction({

  } catch (e) {
    toast.error('Error, please try again!');

I have this code written in a NextJS app. Using @solana/wallet-adapter-react to connect to my phantom wallet.

Everything is working fine when testing locally, and also when passing through ngrok (to provide ssl and https)


However, when I deploy my app to aws amplify (since its nextjs), when trying to send 0.001 SOL, phantom is giving me this error

Not working :(

My deployed app on aws also has SSL and HTTPS configured properly.

  • In the screenshot the URL under Approve transaction text is pointing to the ngrok URL. Maybe that needs to be changed and point it to some AWS URL? Also, make sure your app is launched on process.env.PORT instead of any hardcoded port number. If you are using some added environment variables then also make sure to add them in AWS env settings. Jan 15, 2023 at 13:50
  • @AbdullahQureshi Yes because with the ngrok, it is working, however on the aws deployed website, it is not. Really strange
    – Kob3Bryant
    Jan 15, 2023 at 15:15
  • have you looked into process.env.PORT. Is server up or crashed? check AWS logs. Also, check Solana Explorer logs. Jan 15, 2023 at 15:32

1 Answer 1


In the next.config.js Remove the swcMinify: true


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.