R
Railway

✋|help

ReferenceError: FormData is not defined in Production

Oojoaoguilherme9/13/2023
Hello, my codes are working fine on localhost, but when I push the codes to railway it throws this message when hitting the endpoint
Oojoaoguilherme9/13/2023
1862ff4f-3f51-4d9c-a0c3-26d926471f99
this is the peace of code that is working on localhost and throwing on railway

  @Post(":id")
  @UseGuards(JwtAuthGuard)
  @UseInterceptors(FilesInterceptor("files"))
  async updateLand(
    @Param("id") land: string,
    @Res() res: Response,
    @Body() body: LandUpdateType,
    //@UploadedFiles() files: Express.Multer.File[],
    //@Req() req: Request,
  ) {
    
      const { name, description, tokenId, buildingModelId } = body;
      console.log(
        "Receiving data",
        name,
        description,
        tokenId,
        buildingModelId,
      ); // this is loging on localhost and railway logs

      const formData = new FormData();
      formData.append("Name", name);
      formData.append("Description", description);
      formData.append("TokenID", tokenId);
      formData.append("BuildingModelID", buildingModelId);

      const { data, status } = await axios.post(
        <My other endpoint>,
        formData,
      );
      if (status === HttpStatus.OK) {
        res.status(status).end();
      } else {
        res.status(status).json(data);
      }
    } catch (error) {
      console.log(error);
      res.status(HttpStatus.BAD_REQUEST).send(error);
    }
  }
BBrody9/13/2023
are you sure you are calling the api with https?
Oojoaoguilherme9/13/2023
yes
on the <my other endpoint> its https://<domain>/<endpoint>
I am also receiving the data in the controller here as formdata from my nextjs application, maybe it helps you out...
BBrody9/13/2023
what version of node are you using locally and what version is railway using?
Oojoaoguilherme9/13/2023
my local version
Oojoaoguilherme9/13/2023
how can I see railway node version?
BBrody9/13/2023
it would be in the build table at the top of the build logs
Oojoaoguilherme9/13/2023
yeap just found it
BBrody9/13/2023
set engines.node to 18 in your package.json
Oojoaoguilherme9/13/2023
like this?
Oojoaoguilherme9/13/2023
BBrody9/13/2023
the period denotes an object
Oojoaoguilherme9/13/2023
or this
ok got it
gonna push to see i it works
it worked thanksss
BBrody9/13/2023
no problem!

Looking for more? Join the community!

Recommended Posts
NestJS app starts correctly but receives SIGTERM after 20 seconds (Hobby Plan)Hello ! I've managed to successfully deployed and start my NestJS app, but I receive a SIGTERM 20 sFlask App Keep Getting Called From 192.168.0.xI'm not sure if this is the right place to ask, but i noticed that my app is getting call from 192.1sslIm new to all this so bare with me. I have a .dev site and the ssl giving me some issues. I'm gettiDeploy Logs Incorrectly Highlighting Logs as ErrorI'm having this issue with a custom log formatter on python defined like this: ``` formatter = loggDeployment stuck while pushing the image and failing after ~30minsHi, I have 4 environment in a project. I'm deploying fastapi application using uvicorn, it was takinpg_restoreIs remote postgres pg_restore from a local binary dump file supposed to take super long? It took likRemove 2FAHi!  I had a string of bad luck and lost my 2FA key for my account. Then I proceeded to use my recoRegion SelectionThe database and the services I work with are in the European region so I'm experiencing some delaysExperiencing crash with no output for the reason of the crash.Hello, I'm having issues with my project that I'm working on. I'm trying to test uploading some datRailway StrapiHi. It's taken me entire day and I think I am getting close. I deployed Strapi with postgres on RailLogs down?I haven't been able to see any logs, deploy or build or observability for the past 15 minDeploy from Gitlab failsI am getting the error: error sending request for url (https://backboard.railway-develop.app/graphRailway Github ActionHey i followed the blog online and am trying to deploy my railway app under a `backend/` directory iBuild slowHi, ive pushed some updates to my sveltekit app that makes my buildtime about 4 minutes for some reaIssue Deploying Laravel PHPHello, i'm trying to deploy an already existing project made in PHP, using Laravel, and i'm trying tCustom domain not showing CNameHi! Just wanted to deploy our main app to Railway but when adding a custom domain it shows an error custom domain via googleHi! I am trying to deploy to a custom domain managed by google, and saw a bunch of posts about issueenvironments are linked together?I've two environments, production and development. If I delete one service in development, it shoulDeployment stuck at building phaseDeployments are stuck at #3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1693872Outbound traffic to Google Pub/Sub limitedProject id: bc848a89-1faa-4b26-af86-58c13f7a2e99 I am using using google pub/sub with pull subscrip