serverless / serverless

⚡ Serverless Framework – Effortlessly build apps that auto-scale, incur zero costs when idle, and require minimal maintenance using AWS Lambda and other managed cloud services.
https://serverless.com
MIT License
46.46k stars 5.72k forks source link

sls deploy started throwing following error since last 2 days: str2.indexOf is not a function #12799

Closed rohendra closed 1 month ago

rohendra commented 1 month ago

Issue description

I have suddenly started getting below error since last 2 days. Even if I use the same code & config which has been successfully deployed earlier, still I get the same error.

✖ str2.indexOf is not a function TypeError: str2.indexOf is not a function at Object.validate (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:369:30496) at Object.isArnInParam (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:382:368405) at features.constructor.features.constructor.setupRequestListeners (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:385:1503) at features.constructor.features.constructor.addAllRequestListeners (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:354:83397) at features.constructor.features.constructor.makeRequest (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:354:82515) at operation.authtype.svc. [as putObject] (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:354:91878) at file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:686:2786 at persistentRequest (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:686:1969) at Object.promiseGenerator (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:686:2585) at Queue2._dequeue (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:388:48096) at file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:388:47690 at new Promise () at Queue2.add (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:388:47446) at awsRequest (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:686:2577) at AwsProvider.request (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:702:32353) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Context

Summary Report -----------------

Service Overview

Command

deploy --verbose true,--stage prod,--config serverless-v4.ts

Error Message

str2.indexOf is not a function

Error Stacktrace


at Object.validate (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:369:30496)
at Object.isArnInParam (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:382:368405)
at features.constructor.features.constructor.setupRequestListeners (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:385:1503)
at features.constructor.features.constructor.addAllRequestListeners (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:354:83397)
at features.constructor.features.constructor.makeRequest (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:354:82515)
at operation.authtype.svc.<computed> [as putObject] (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:354:91878)
at file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:686:2786
at persistentRequest (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:686:1969)
at Object.promiseGenerator (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:686:2585)
at Queue2._dequeue (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:388:48096)
at file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:388:47690
at new Promise (<anonymous>)
at Queue2.add (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:388:47446)
at awsRequest (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:686:2577)
at AwsProvider.request (file:///home/ubuntu/.serverless/releases/4.3.2/package/dist/sf-core.js:702:32353)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
skierkowski commented 1 month ago

@rohendra We're looking into this issue. In the meantime, as a temporary work-around, you can pin the version 4.2.5 as it doesn't have this issue.

Add this to serverless.yml

frameworkVersion: "4.2.5"
jacobmaurer commented 1 month ago

Hi there - we're hitting this same bug - ~I tried pinning to 4.2.5 as suggested but same error. Any other workarounds or suggestions at this time?~ My mistake - I pinned it incorrectly. Working fine with frameworkVersion of 4.2.5 - thanks

rohendra commented 1 month ago

@skierkowski Still getting same error.

We had already pinned version 4.2.5 in serverless config. See below. I have also uninstalled serverless and installed 4.2.5 version, still I get 4.3.2 when I do sls -v. See screenshot.

import type { AWS } from "@serverless/typescript"; import functions from "@functions"; import documentation from "./documentation";

const serverlessConfiguration: AWS = { org: "foundercrateti", app: "foundercrate-app", service: "foundercrate-api", frameworkVersion: "4.2.5", plugins: [ "serverless-offline", "serverless-domain-manager", "serverless-plugin-split-stacks", "serverless-openapi-security", "serverless-prune-plugin", "./disable-outputs.js", ],

Screenshot 2024-09-12 at 1 25 40 PM
czubocha commented 1 month ago

@rohendra ~Please follow this guide to pin the version~. edit: Sorry I haven't noticed you already added frameworkVersion to the config.

czubocha commented 1 month ago

@rohendra @jacobmaurer The fix has just been released in v4.3.3. Please give it a try and let us know if you’re still experiencing the issue.

rohendra commented 1 month ago

@czubocha Thanks. Issue is resolved.

jacobmaurer commented 1 month ago

@rohendra @jacobmaurer The fix has just been released in v4.3.3. Please give it a try and let us know if you’re still experiencing the issue.

Appreciate the quick fix and heads up - confirming it's resolved as well.