Back

Appwrite 1.4.2 returns method POST instead of GET

  • 0
  • Functions
elemin67
10 Sep, 2023, 00:23
TL;DR
The user is experiencing an issue with Appwrite 1.4.2 where the method is returned as POST instead of GET. Some suggestions were given, such as checking the SDK version in the readme, upgrading to a newer version, and ensuring that the IDE is configured correctly. The user also shared code that uses Appwrite 10.0.1. No solution was provided in the thread.
elemin67
10 Sep, 2023, 00:25

usin "appwrite": "^10.0.1"

elemin67
10 Sep, 2023, 00:29

server sdk looks:

TypeScript
import { Client } from 'node-appwrite';
import { fetch } from 'undici';

export default async ({ req, res, log, error }) => {

  // If something goes wrong, log an error
  error('Hello, Errors!');

  if (req.path === '/eur') {
    const amountInEuros = Number(req.query.amount);
    const response = await fetch('https://api.exchangerate.host/latest?base=EUR&symbols=USD');
    const data = await response.json();
    const amountInDollars = amountInEuros * data.rates.USD;
    return res.send(amountInDollars.toString());
  }

  if (req.path === '/inr') {
    const amountInRupees = Number(req.query.amount);
    const response = await fetch('https://api.exchangerate.host/latest?base=INR&symbols=USD');
    const data = await response.json();
    const amountInDollars = amountInRupees * data.rates.USD;
    return res.send(amountInDollars.toString());
  }

  return res.send('Invalid path');

};
Drake
10 Sep, 2023, 01:07

Mouse over createExecution. What do you see?

elemin67
10 Sep, 2023, 01:08
Drake
10 Sep, 2023, 01:39

That's weird and confusing...that's for the code in the same folder as the package.json that says 10.0.1?

elemin67
10 Sep, 2023, 08:10

Yes

Drake
10 Sep, 2023, 16:51

For some reason, your IDE isn't picking up the right types.

Drake
10 Sep, 2023, 16:52

This version is old. Please upgrade

elemin67
10 Sep, 2023, 16:52

Which Version should work

Drake
10 Sep, 2023, 16:54

Always read the readme to see what version of Appwrite the SDK version is for

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more